You can do that the other way round since I already made a ReadIntegers file.
BTW - what device (phone) are you using?
That can be ruled out - the message is a simple reminder, there is no verification. Manual enablement of Bluetooth is not a problem but we can use Activity Starter to automate, I will show you how later - let's just get the basics working first.
Samsung galaxy S22 running android 14
OK - not one to hit you with a sudden surprise
I gave it another shot.
I made a brand new project and imported the newest BLE extension 20240822 to be 100% sure im using the newest extension.
Next i tried using the RegisterForInteger, RegisterForString, RegisterForFloat block with the arduino code that matches the type.
Every time the RegisterFor block is called the app crashes, and the block you suggested for debugging that's suppose to give some debug info when Screen1.ErrorOccured is fired doesnt have enough time to show anything since the app crahes.
Next i tried skipping the RegisterFor block and just straight up called ReadInteger directly in the BluetoothLE1.Connected block and it also just crashes the app immediately... same with RegisterForString and Float.
Is this in the Companion, or
is this in a built app?
There is a newer Companion at
It's in an app that I run on my galaxy S22
APK?
How do you verify that the crash occurs during "Register For" ?
What we can do is output to a file, step by step.........
Can you upload your Project and Sketch files for us to check?
yes i download the project as an APK file and transfer it onto my mobile using USB then install it.
I disable the RegisterFor block and then open the app on my mobile...
The above does not crash, but as soon as the RegisterForInteger is enabled it always crash. Same with the other RegisterFor blocks... and also the same if i use a ReadInteger block etc.
Here is the aia project file:
Fresh.aia (201.1 KB)
and here is the Arduino sketch ino file:
BLE_Nano33.ino (2.5 KB)
Right now i have removed as much as possible to keep the program/app as simple and easy to read as possible.
All i want is to be able to open the app on my Galaxy S22 and receive an integer from the ardruino.
Connecting using BLE works fine and i can also send variables from the app to the arduino, but not the other way around.
By the way do i need to do anything special with the BLE block icon?
Is the above ok?
I already played around a little and test NoLocationNeeded, but i got the same result.
That's fine. You are not the only developer with a Samsung S22 BLE issue, but I don't think it's the phone at fault.
Have tried a Read Block instead of a Register Block? I made a simple Project for you.
Yeah i've tried adding a clock that calls the ReadInteger block after 10 seconds... the app connects correctly to the arduino, and then after 10 seconds (minus the seconds it take to connect) it crash. And Disabling the ReadInteger block fixes the crash issue like always.
You can simply scan the QR code, App Inventor will use WiFi to send the APK to your phone.
I apologize as I haven't had time to read the thread in its entirety, but have you power cycled the Bluetooth stack on the phone (usually turning Bluetooth off and on is sufficient)? The typical BLE use case on Android involves the UUIDs not changing so the OS caches the services/characteristics advertised by the device. If you changed the UUIDs, App Inventor may be making the request but the system says they don't exist since the cache is stale, resulting in the crash.
A second thing, if you're comfortable doing it, is to enable Developer Mode on your phone and then using adb logcat
to obtain a stack trace of the crash. This will help pinpoint where the code is failing on your specific device.
I had not tried turning off BLE and on again, but i have tried restarting my mobile phone, i'm guessing that should also do it.
Just to be sure i tried turning off BLE and back on again right now and it's the same result.
I will look into adb logcat and try to figure that out - thanks for the link Chris.
Im hoping to get it up and running during the weekend, but i have a few other plans.. ill fit it in
I just dug up my old Oneplus3 phone running android 9.
I get the exact same reaction when i run my app on that phone.
I'll look into the adb logcat next
I havnt given up... I'm just a bit busy these days.
I got the Oneplus phone set to developer mode and reading about adb logcat.
Maybe next week.
Hello @App_novice,
Try this inside when BytesReceived
Make sure that the length of the received is equal to or greater than the indexes being accessed.
Also, make sure that the UIID corresponds to the characteristic you expect.
Okay thank you osmany I will try that when I get home Monday