mit-cml / appinventor-extensions

Source code of extensions published for MIT App Inventor
Apache License 2.0
86 stars 94 forks source link

App crashes when bluetooth LE connects to a device which is not blue tooth enabled. #60

Open ellelili2025 opened 2 years ago

ellelili2025 commented 2 years ago

Describe the bug When lots of users start to use microbit in App Inventor, they get used to manipulate .hex code and don't realize that their .hex code disables blue tooth service accidentally. App Inventor works with Microbit through blue tooth LE extension, App crashes when it tries to connect to microbit through blue tooth LE while blue tooth service is not available in the microbit. We should display an error message and remind users to enable blue tooth service in the device when that happens instead of crashing the companion, which puzzles users.

Affects

Expected behavior

Use the attached the .hex code and .aia project file. App Inventor should gracefully let users know that blue tooth service in microbit is not available instead of crashing.

Steps to reproduce

Upload the attached .hex code to microbit and use the attached . aia project file. open the project file in App Inventor. click the scan button click the stop scanning button Select your microbit device discovered by App Inventor click connect Companion disappears.

microbit-empty.hex.zip MicrobitLED.aia.zip

ellelili2025 commented 2 years ago

@QunCAO1 Could you start looking at this and I will look for another project for you after it?

QunCAO1 commented 2 years ago

Hi LiLi,

After I have reproduce the bug, I got the following error message image

I found that in order to modify the error message to notify users to enable blue tooth service, we should change the code in edu.mit.appinventor.ble.BluetoothLEint, and here is the modified version. BluetoothLEint.zip

Thanks, Cloth, CAO Qun

dalemi666 commented 1 year ago

Hi QunCAO1 did you solve this issue ? I am having the same problem with BLE and android > 12 but i cannot found any new version of the app inventor extension. I am not able to deal with java unfortunately... Emilio.