I am trying to write an app where I would like to control a raspberry pico w from an android device.
For the bluetooth connection I use the following blocks:
I have read a lot of previous threads with similar questions, but there are so many that I cannot figure out the latest recommendation.
Here are my problems and questions.
This code runs without problem on my Android 5.1 moto G phone, but it gives the 908 error message on my Android 10 PicassoTab_X. After this error message, the press of the button does bring up the BLE device list. This is true for both the companion and the downloaded and installed version. On the Android 10 device, after the error message it does ask for location permission when it is run the first time. After that it just shows the error message and then I can scan for devices. Location is turned on on my device.
Is there any way to avoid the error message? I would like give this application to others, and it would not be good if they see an error message (before they can use the app as intended).
In earlier threads I have seen several, more robust solutions (that check Android version and act accordingly). Can someone please point me to the latest of these recommended approaches?
In case it is helpful, here is the aia file: BLEtrial.aia (199.8 KB)
This is not specifically related to BLE, but it is a "trick" to avoid that error messages are shown on the screen.
If you use the block
you can intercept the error and, by putting nothing in the do statement (or a fake procedure) nothing will be done nor shown. Obviously if the error message, on the oppposite side, is meaningful, you will lose it.
As I said, it's just a trick.
This sounds like a bug in the permission logic in the BLE extension. Also, looking at your project you have the NoLocationNeeded property checked so that should have suppressed the check in the compiled app.
Next to the NoLocationNeeded tickbox it says that it is for Android 12 (and forward). I do not have access to a phone/tablet like that. Would it be possible for someone to try the code and tell what happened? Maybe that tick does suppresses the message there. I would also appreciate if someone could try it on a different Android 10 device to see if it is a device-specific problem with my tablet or a general problem.
Unisntall any previous version of your app.
Install a freshly new one with my block.
At the first run the error message is shown, so the user must enable the permission in Android settings.
Exit the app.
Run it the second time, you will see that the error message isn't shown anymore.
Thank you, this indeed worked on my tablet. At the moment I am reluctant to add this though to my app, because (as you said), if it is a genuine problem, then I am just ignoring it. For the moment I try to find a newer version of Android to see if the error message is there for version 12 and above. If not, I may leave it as it is (and hope that if this is indeed a bug, then it will be fixed at some point).