AskForPermission (Bluetooth)

Hello good morning. I hope you can help me.
I am developing an application where I link via Bluetooth to an Arduino ESP32 device.
I made 3 "virtual screens" to be able to maintain the connection when exchanging "screens".
Once I install the APK, when I enter it for the first time, the notification appears asking me for permissions to scan with Bluetooth, I accept, but in the first search there are no nearby devices. I have to close and reopen the app, and they just appear correctly there
When I initialize the only real screen, I have the blocks set up like in the image.
Something is wrong?

Do you Scan for devices before that you ask for permission?

Hello @Arman
No. I start the app for the first time, accept the permissions, and then when I go to the Bluetooth "ListPicker", no devices appear in the list.
I have to close the application, and reopen it so that they begin to appear. That is, from the second time onwards it works correctly. But it is something that the user may not understand.

Please show your relevant blocks (blocks that you scan within it)

I think I didn't quite understand what you wanted to tell me (sorry, my language is Spanish).
But, I think you asked me about the Bluetooth "ListPicker" blocks. He left them for you below. Regarding the permission blocks, I execute them as soon as the screen starts (as shown in the image in the post)

where do you scan for devices?

I have 3 "virtual screens" so I can maintain the Bluetooth connection when switching between them. I enable and disable them with the "Visibility" option. Therefore I have only one real screen.
And I perform the Bluetooth scan on the "Settings" screen.

First, ask for permission, use the Permission Granted event and trigger a device scan there.

Thank you all very much for your time!
Thank you @Anke . I will try to adapt what you shared to my project. It will surely be solved that way!

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