These are not my original blocks and I have posted many examples and solutions for the BluetoothClient component (as well as the BLE extension) in the past months.
My blocks always looked or should look something like this:
BTclient_test1.aia uses your blocks and doesn't work. BTclient_test2.aia uses my blocks as I always posted them. This works. So build the APKs and check it on Android 12+...
(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)
The easiest solution, for immediate relief
(from @Barry_Meaker) ...
I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).
on your phone,
goto settings
search for your app
in App Info for your app select Permissions
change Nearby Devices from Not Allowed to Allowed
Done
By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.
A more complex approach, for professional app development:
One is without extension and the other is an extension.
I explicitly pointed out this problem in my answer(s) to ABG. So please read this again. (I deliberately left this block there "grayed out" to point out the problem and the solution.)
Use a timer to hide the ListView once a connection is established.
Thanks a lot for your wise help.
Things are a litlle bit clearer for me but i still have a basic issue.
I'm trying to send a 2 bytes Number 513 but not able to receive the correct number in Arduino serialDisplay. I read lot of discution but still don't understand where i screw up ?
No, I am just rummaging for a way to reduce the complexity of getting permissions without having to remember asking for it or without having a way to ask Android if I already have permission.
I'm searching for an easy stock answer for the board, without the experience of the people with actual experience.
you can try to ask as much as you like for permissions...
if you already have a permission, you do not get the permission window anymore and the event PermissionGranted does not fire anymore... because of the latter it might be a good idea to know if you already have that permission
As I've said often enough, Google makes life more difficult for all of us – every year again with these (mandatory) idiotic targetSdkVersion updates. As long as users and developers just put up with this BS, this probably won't change. Btw, all Android users face these problems, not just AI2 users.
I 've checked your remarks regarding BTSerial speed and lower it @9600.
I've also changed 513 to 512
I've also replace BTSerial by the embedded Serial channel, but same results.
Please find bellow results of my tests, and obviously the transmission BTserial speed has change something but still don't understand.
int Octet1 = 0;
int Octet2 = 0;
int value = 0;
void loop() {
if (BTSerial.available() >= 2) {
Octet1 = BTSerial.read();
Octet2 = BTSerial.read();
value = (Octet2 << 8) | Octet1; // Combinez les deux octets pour obtenir une valeur 16 bits "value"