Everyone has suggested giving App Inventor Permission to "Access Nearby Devices" in settings. However, when I go to settings on my tablet, there is no option to give permission for bluetooth or "nearby devices". What the heck? Screenshot below of my permissions for AppInventor.
Why a screenshot of the companion app?
Did you build your app and test the apk file?
Taifun
.---
(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)
The easiest solution, for immediate relief
(from @Barry_Meaker) ...
I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).
on your phone,
goto settings
search for your app
in App Info for your app select Permissions
change Nearby Devices from Not Allowed to Allowed
Done
By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.
A more complex approach, for professional app development:
The screenshot is to show that I do not have the option to give bluetooth permission to the app. I am trying to follow the instructions you posted, but it never asked me for Bluetooth permission and there’s no option to add those permissions in settings.
I have not built an APK file yet, just running it through the companion app.
I have now tried building the APK file and installed the app, but I still get the exact same error. I have tried to follow your instructions for allowing Bluetooth permissions in settings on the tablet, but please see the screenshot below. The Permissions setting is grayed out saying no permissions were ever requested. How can I grant the app the permissions for Bluetooth then? I don’t understand.
I tried both and neither one worked. I don't get the error message anymore, but the list of bluetooth devices does not appear. Here is a screenshot of the app, in both cases it looks like this:
If it's not a permissions issue, then do you have any idea why the list of devices is not appearing? I am able to connect to my arduino with the LightBlue app, so I know bluetooth is enabled and working on the tablet.
Also Anke, I should mention that I found another thread where you posted a file called:
"BLE_permListDevConnect_allAndroid_2023728.apk" and that one actually did work. I can see and connect to my Arduino with it. Would it be possible for your to share the code for that project so I can see what I am doing wrong in mine?
I'm reluctant to post an AIA in such cases because most people then make their adjustments and then claim it doesn't work. The fact that adjustments have been made usually only becomes apparent after long negotiations and many unnecessary posts. Therefore I prefer to post APK links.
Yes I am referring to that App. I used it to connect to my Arduino, so I know bluetooth is working on the tablet. Do you have any idea why neither my code nor the two projects you posted above are working to show the list of Bluetooth devices?
Ok, thank you! I see the problem now. My code was using a regular BluetoothClient instead of the BluetoothLE from the BLE extension. I didn't realize they were different! I just wrote a new code with BluetoothLE and it is able to find the device and connect.