Bluetooth no longer works on API 12,13 and probably 14. I'm having difficulties

Dear Evan, I did what you suggested, I compiled it using ai2-test.appinventor.mit.edu and I also used the fix you mentioned previously. I published a beta test version on playconsole and asked an Android 12 user to test it for me and unfortunately the error persists. Firstly, if Bluetooth is not activated, the application simply does not open, a black screen appears quickly and then disappears. I had already received this report previously, below is a printout.
Sem título

To be able to open the program, just activate Bluetooth manually first, even then pressing the scan button, nothing appears in the list of Bluetooth devices, it is completely white

I think your problem lies somewhere else entirely. I made some changes/fixes. Send this link to one of your Android 12+ users to test it there (*):

Apart from that, I noticed the following:

  1. DefaultFileScope=Legacy
  2. FileScope=Shared
  3. WRITE_EXTERNAL_STORAGE permission requested on all Android versions
  4. Theme: Classic

I had to remove at least point 3 because firstly it no longer exists on Android 11+ and secondly it doesn't seem to be necessary on any Android version.


(*) Your app will not be overwritten on his device because my version has a different package name.

1 Like

My Addresses and Names worries were based on my ignorance of the paired devices list behind the scenes.

1 Like

Hi Anke, thanks for your help!

I sent the file to the user and we tested it via video call.

The application requested the activation of Bluetooth when opening the app and the MAC also appeared correctly in the list of devices. Apparently everything worked correctly.

I took the opportunity to test it on my Android 10, but on mine it didn't ask to activate Bluetooth (before it asked for activation), but it opened normally, I activated Bluetooth manually and it also worked.

Yes, I added the following block and it should work now also on Android < 12 if BT is disabled:

Multec_700_final_14_fixed.aia (141.8 KB)

1 Like

Anke, Could you confirm if the main incompatibility was occurring with the routine for saving the MAC address in the DB and the fact that I request it to be read at startup? I am very grateful for your help and that of everyone. I have certain difficulties, but I'm interested in learning and the simple fact of being able to create my own application is very pleasurable.
I'm releasing the update on the playstore and will wait for user reports. Many Thanks!

No, the main problem was that WRITE permission was requested and that this no longer exists on Android 11+ (as I already explained). As a result, the required BT permissions were no longer requested correctly and completely (and therefore could not be granted). Furthermore, the query as to whether BT is enabled should only be made AFTER the BT permissions have been granted (at least if this query is in the Screen.Initialize event).

1 Like

Perfect, can I then activate the function to save the MAC that was connected the first time, so that the next time it is automatically selected?

The last block in the Screen.Initialize event (so it is already there):

So build the app, upload it to your Play Dev Console as an internal test track, register your Android 12+ user as a test user and let him test this version.

1 Like

correct, is that before I also requested it in "PermissonGaranted" and I was certainly wrong, as you see that you disabled the request there. But I managed to understand clearly what went wrong. I'll just wait for the publication and feedback from users and then consider the problem as resolved. Again, thank you very much!

1 Like

OK, let us know the result. And if it's positive (which I assume), then close this topic.

1 Like

Today I received the first reports of the applications fully functioning. Again Thank you very much for your help!

1 Like

You are welcome, I am sure it will help others as well.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.