When scanning for devices nothing is found

I'm confused, it is the BluetoothClient component that I'm using (I think). But your code found the bluetooth devices that had been previously paired with the tablet, where as mine just went to a blank page.

Greetings,
I have the same problem as YellowwLizard. I don't get a list of devices on my mobile device (Samsung A52) when the "Scan devices" button is tapped, it just shows a blank screen with no device list. I am using an ESP32 microcontroller.
A few months ago when I was dealing with the same projects everything was fine and working properly. Interestingly, on my son's mobile device (Huawei), app works correctly.
Likewise, the bluetooth connection in the "Serial Bluetooth Terminal" application functions correctly.
This is my code in blocks that worked correctly three months ago.

Unfortunately I can't help you with a solution as mine just decided to cure itself, I have no idea why or how!
I got so fed up with it, I deleted all the blocks and started again. I replaced every block EXACTLY how I had them before - and then it worked.
That may be worth a try but I'm sure there must be a more scientific answer, but I don't know what it is, sorry.

1 Like

Thank you very much for your honest answer. I already tried something similar, but I still didn't delete all the blocks completely. It frustrates me that everything worked a few months ago and now it doesn't, and that it works on the Huawei phone but not on my Samsung A52.
I will try to do the same as you.
Thanks again and greetings from Croatia.

It has already been explained in this topic. Next time read the thread before asking a question. I will repeat:
No scanning and connection permissions.

(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.


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.

Special note for Xiaomi devices:

As a 'power user' you obviously understand the above blocks, unfortunately they are double dutch to me.

What are you supposed to with them?

I have added the 3 blocks to the beginning of my blocks and added the Tiny DB and a 'list view' box, but it doesn't seem to do anything. It does find and display the BT module but doesn't select anything.
The original problem (with which I started this thread) has now just gone away, as I said above, but I have no idea why!
I have now completed my project (without the 3 above blocks) and it all works perfectly BUT only if I connect the android companion app to the PC. I have downloaded and installed the .apk file on the android device, the app displays the right info and looks OK until (yes, you've guessed it!) the 'find device' button is pressed when all I get is a blank screen again.

So is this connected with my original problem and if so will the 3 extra blocks solve the problem, even though it works perfectly until it becomes an apk?
If the extra blocks will solve the latest problem how do I use them and how do I incorporate them into my code?

This what I've got so far:-

blocks(22)

Any help greatly appreciated,
Thanks

I still don't see in your blocks the most important "AskForPermission" blocks that I showed above. Modify your blocks as suggested by adding scan and connection permission requests.

Of course, instead of ListView which is in the example, use ListPicker, because that's what you use in your app.

1 Like

Thanks for your reply.

What I listed above is how I now have it (almost) working. I have tried it with the other 3 blocks (the ones with permissions) and I did change list view to list picker. I put the 3 blocks above the ones listed above, but it all made no difference.

I have downloaded and installed 2 apk versions, one with the extra 3 blocks and one as above but they both behave the same.

Thanks again for your help.

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