nRF52833 DK is a really nice board. Your phone is a good spec too - it started on Android 10, what version of Android are you running now?
Android Version 12.
Even if I close the app it will not disconnected I have to close the app from the background then it gets disconnected. I tested with nrf android application (nrf Connect for mobile) and it worked fine with this.
The BLE extension has not to my knowledge been tested with Android 12.
App Inventor itself does not officially support Android 12, you can't compile an App for 12 [API 31] yet but with the Bluetooth specs being good to go, I would expect disconnect to work. A new release of App Inventor will be out very soon (hopefully in just a few days time). That might make a difference.
Ok. But I have a MI PAD 4 that is running on Android version 10 with Bluetooth 5.0, A2DP, LE and having the same issue with disconnect.
Time to show us your Project, and your Script. Upload them here.
I'm away from my desk now, back in the evening, UK time.
...and the Script.
If another Power User takes a look, I suggest that taking the User to the Phones BT connection via Activity Starter would be a temporary work-around.
By Script you mean code for nrf52833?
I have never used activity starter. Checking on google gives a lot of things like classes and properties and this is confusing. Can you please show a blocks diagram for disconnecting to BT using activity starter.
Yes.
It takes the User to the BT settings, it does not automatically switch BT on or off.
Action: android.intent.action.android.provider.Settings.ACTION_BLUETOOTH_SETTINGS
Class:
com.android.settings.bluetooth.BluetoothSettings
Hi androidz
Does your App actually work? There is a lot of BT related code that is unnecessary, and bits such as a millisecond Clock Timer - is that really necessary?
Yes I have tested this app and it works fine. The clock2 timer has nothing to do with BT as it is just to show the time in the app.
It will slow the whole App down on most smartphones.
Well I can delete this and then check the disconnect action. But I am using clock1 to read data from DK every 200ms.
..actually the BLE Extension you are using is out of date.
I updated the extension to Extension Version: 20200828 and removed the clock2 but still disconnect is not working. Looks like it the app doesn't have full control over disconnect function it only works if I close the app from background or turn off the Bluetooth.
But if I call bt_disconect()
from nrf52833dk then it gets disconnected.
It will not necessarily affect the disconnection as a timer, but both Clocks must be disabled before you disconnect.
That is a Bluetooth Classic method. You are actually receiving and processing via a BLE 'Floats Received' Block so you could instead use 'Register for Floats' and simply work with the timing in the microprocessor script.
The replace text code is not necessary - the 'floatValues' are a list, just use the List Blocks to get the values.