Error 908 and Error 507

Hallo
i have a project for my bachelor thesis in witch i have to use Bluetooth module.
I have an Arduino Mega 2560 and a HC-05 Bluetooth Module VERSION:3.0-20170601.
I am using a Glaxy S9.
I have been facing a Problem of Connectng Mit App Inventor with the Bluetooth Module despite pairing it with my Phone was succesfull.

I received error 507 in which App Inventor would not connect to the HC-05 module despite showing it in the list picker, but then I figurated the problem which led me to error 908.

I get error 908:






Thank you in advance

the AskForPermission method accepts only one permission, but not a list of several permissions, see the following links about how to do it

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:

See Bluetooth liste of devices deosn't work anymore - #7 by Anke
Special note for Xiaomi devices:
I have an error with bluetooth on android 12, Xiaomi Poco X3 NFC - #20 by Patryk_F