Hello and thank you for that great topic !
For once on a forum i'm not writing because i have issue(s) but because i fixed them (first steps with the Particle ecosystem may have made it harder to me).
I hade issues to simply make the code run(1), then to get BLE working(2), then to get advertising working(3), then to find the device on the android app(4), then to have addCharacteristic working(5) (program was stopping when addCharacteristic was called).
2 days after hitting my head on the walls, ii finally made it work.
First of all i'm using the Wokbench on VSCode because i don't want my Xenon to be connected to the cloud. Not sure what was wrong for the 2 first issues, maybe i forgot to do some "Clean app" between my hundred of testing, most probably something else noob related...
Regarding the 3rd and 5th issue it was apparently due to a mismatch version of the compiled app and the deviceOs installed on my Xenon.
To fix this :
- Make sure Workbench is up to date, this topic helped me (strangely it didn't install with latest deviceOs until i do that...)
- Update your card to the latest deviceOs via the command line
particle update
- Check your deviceOS version :
- Put your card in "listen mode" by pressing "mode" button for 3 seconds. Didn't work for me. I had to keep pressing "mode" button then hit/release "reset button" and release "mode" button once LED was blinking purple. Then the LED should blink blue which means it's in listen mode.
- Connect to the card via Putty and just type "v" on the prompt window to display the os version, you should get something like this :
- Select the matching version on workbench by clicking on the bottom bar :
Then advertising AND addCharacteristics should work. At first advertising worked me but characteristics didn't work until i had matchin deviceOs versions.
About the 4th issue, the device not poping up on the android APP :
- Spoiler, it probably actually is displayed with with no name
- For everyone the device seems to be listen at "Xenon-xxx", it did once for me, but that's all...
- You can either check all the devices to find the one that declares your custom serviceUuid, or force the name of your BLE device
Simply add this line to give it a name :
advData.appendLocalName("Your custom name");
Aaaaand... that should be ok.
Enjoy