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

Dear masters, unfortunately my application is no longer working correctly on api 12, 13 and probably 14. I have received reports from my users, I have already tried some approaches that I found here on the forum, but I am not able to solve the problem.

What makes it even more difficult for me is that I don't have a cell phone with these APIs to test, my cell phones are old, they use API 8 and 10....
Below are some attempts I made, to be able to activate the bluetooth permission and scan the devices, as mentioned above, starting with api 12 it no longer works.... Thank you for everyone's help and please understand that my English is not good. Well, I'm already a certain age. Thanks!



Are you using classic Bluetooth (i.e., BluetoothClient), or the Bluetooth low energy (BluetoothLE) extension?

1 Like

Dear, I am using the classic bluetooth client extension

Ask for permission correctly as shown in this example

Taifun

1 Like

Below are the blocks that I modified, but the user reported that it still doesn't work on Android 13.
This makes me sad, as it worked perfectly in previous versions...

In that api_level procedure, high high do the api levels go in that text block?
The block image stops at ...

1 Like

HI ABG, Here's the full text:

1.0,1\n1.1,2\n1.5,3\n1.6,4\n2.0,5\n2.0.1,6\n2.1,7\n2.2,8\n2.2.1,8\n2.2.2,8\n2.2.3,8\n2.3,9\n2.3.1,9\n2.3.2,9\n2.3.3,10\n2.3.4,10\n2.3.5,10\n2.3.6,10\n2.3.7,10\n3.0,11\n3.1,12\n3.2,13\n3.2.1,13\n3.2.2,13\n3.2.3,13\n3.2.4,13\n3.2.5,13\n3.2.6,13\n4.0,14\n4.0.1,14\n4.0.2,14\n4.0.3,15\n4.0.4,15\n4.1,16\n4.1.1,16\n4.1.2,16\n4.2,17\n4.2.1,17\n4.2.2,17\n4.3,18\n4.3.1,18\n4.4,19\n4.4.1,19\n4.4.2,19\n4.4.3,19\n4.4.4,19\n4.4W,20\n4.4W.1,20\n4.4W.2,20\n5.0,21\n5.0.1,21\n5.0.2,21\n5.1,22\n5.1.1,22\n6.0,23\n6.0.1,23\n7.0,24\n7.1,25\n7.1.1,25\n7.1.2,25\n8.0,26\n8.1,27\n9,28\n10,29\n11,3\n12,31\n12.1,32\n13,33\n14,34

Notice how @Anke's sample asks the Bluetooth component for addresses and names:
image

I don't see your code asking for that anywhere.

1 Like

Sounds like you have a helpful User. You need to find out exactly what error occurs. Add a Screen Error catcher to your Blocks for example.

1 Like

Use Anke's extension instead.

1 Like

Retrieves a MAC address from TinyDB so presumably that's a one-off on first run of the App?

1 Like

Is the collection of the BlueTooth addresses hidden in the procedure procIsBlueToothEnabled?

The OP posted the Screen.Initialize block and the PermissionGranted event.

Where else could it be hiding?

For a first run, it has to be done somewhere.

1 Like

That should be just as it says and no more. The app could be for a specific device family that always has the same address, so that known address as shown on a label on the device, or in a User handbook, could be hard coded. Only Maiko knows the answer.

1 Like

Sorry for not giving more details, let's go in parts:
The application takes information from a bluetooth device that I developed with the esp32, the user needs to connect to this device, the MAC address will always be the same for each user/device.
After selecting the MAC, it saves it in the DB so the next time you open the application you don't have to search for and select it.

The application already has a collection of error information, see print.


From what the user described to me, he clicks the search button, but nothing appears in the list, I believe it is a lack of access permission to bluetooh devices.

I'm attaching the complete program, because I really need to solve this bug.

Multec_700_final_14.aia (140.9 KB)

I am very grateful in advance for all of your efforts.

ezgif-5-d3d714e75a
how it works on android 10

I think this ultimately comes down to where in your code the AddressesAndNames block is used. Prior to Android 12, this block can be used anywhere since the permissions it requires are granted when the user installs the app. Starting with Android 12, the block cannot be used in certain contexts because it requires asking the user for runtime permissions. Can you show us where in your code that block is being used?

1 Like

Dear Ewpatton, I uploaded the AIA file available above. TKs.

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

I apologize for that, I thought it would be the easiest way for you to see all the code, but thinking about it that way, you're really right. I have difficulty understanding some solutions, even more so because I use a translator, which at times, technical terms are not understood... I will post some relevant blocks, I hope it improves understanding.

Where in your blocks do you store a mac address in tag MAC in TinyDB?
I can see you only reading tag MAC from TinyDB

Taifun

1 Like