When scanning for devices nothing is found

FINALLY! I have been going insane over this for the last couple of months, today I finally got it all working.

So thanks again to everybody who tried to help but it appears there was an 'error' in one of the extra permission blocks suggested by ABG above. (I put 'error' in inverted commas because there may not have been an error and there might have been something else wrong, no idea, but what I added solved the problem).

So I changed the second block to this and it all sprang into life.

As you can see, I added a second 'call' box which solved the problem. Maybe someone who understands it all far better than I do can dissect my solution and decide if it was good/bad/needed or whatever!
All I know is that it worked, so thanks again for all the help and I hope someone else may find my solution helpful.

1 Like

Yes, there is a bug in blocks from ABG.

There are correct blocks in this post.

Just drag them to the project and change ListView to ListPicker, add TinyDb and that's it...

Show me, so I can fix it?

This is the original block:

When you ask for the BluetoothScan permission in the Initialize event, only TinyDb is set to true in the above block, and the BluetoothConnect permission is not asked.

You need to change the order like this:

Now when you grant BluetoothScan permission, you will be asked for BluetoothConnect permission.

You can also change the Initialize block by replacing the BluetoothScan block with BluetoothConnect.
But in my opinion, the order of Scan first, then Connect is more logical.

1 Like

(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)

These blocks can be dragged into your Blocks Editor to request permission(s) for Bluetooth non-BLE scanning and connecting. All three parts are needed.

You also will need to pull in TinyDB into your project.



When Permission Granted (@Patryk)

Thanks to @Anke for the original code.
My changes include

  • use of the Screen1 permission blocks to avoid the possibility of a typo
  • using a TinyDB tag particular to BT permissions and only for BT permissions.

(Thanks to @Patryk for correction to grant order)
Special note for Xiaomi devices:

1 Like

Even after entering the suggested blocks, the application does not offer me a list of bluetooth devices. It sends an error:

This is my code:

it looks like the definition of your csv table is incorrect...
here you can find the correct csv string

Taifun

1 Like

Here's an .aia
apiLevel.aia (3.4 KB)

1 Like

I tried to enter the suggested sequence ( 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…) in the code, but there were no results.
It shows the same error.
I am a beginner with MIT APP and I do not fully understand all the advice and recommendations.
Thanks a lot for trying to help though.

I don't know how to open the offered .aia, but in fact I don't know how and where to use it.
Thanks for trying to help.

The correct string is

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,30\n12,31\n12.1,32\n13,33\n14,34

Taifun

1 Like

Unfortunately, even that sequence does not accept me and reports an error (Invalid list of pairs). I must have made a mistake in something else.
Thanks for the help, I'll try again tomorrow maybe with some corrections. But it's still a bit overcomplicated, so many lines of code just to connect to bluetooth.

Show the error screenshot for the list that Taifun showed.

Project->Import
then use the backpack to transfer parts from project to project.

1 Like

Finally it worked for me too. :grinning_face_with_smiling_eyes:
Thank you guys very much for your time and effort. ABG I was able to open .aia and later use backpack. Many thanks also to Taifun, Patryk_F and YellowLizard.
I followed your instructions and used your blocks but it only worked when I corrected the second block as shown by YellowLizard.
This is my code that works and the mobile app prints the bluetooth list.

Finally, just one more question, guys. Which is why a few months ago everything was working on the same mobile phone and the bluetooth list was printed even with a much simpler code (the one you can find on You Tube tutorials), but now only with this very complicated procedure. :wave:

Because of the SDK31 update from last year... Google restricts the Android system from year to year and introduces new rules... the reason usually is to provide better security... thank you Google for protecting us... /sarcasm

Taifun

3 Likes