BLE with android 9

Hi all,
I have created an app that is working on my phone (android6) but not on my tablet running under android 9. The BLE device are not appearing in the list during the scan.
I have read lots of topics ( https://community.appinventor.mit.edu/t/no-devices-found-during-ble-scan-on-android-10/13756 ) but didn 't found any solution for android 9. ITried also this latest BLE extension but without succes (BLE-with-extention_api.aix)
did somebody make it run on android 9 ? (looks that for android 10 it s ok now but for 9?)
thx,

Hello lenoyl

Show us your Blocks (right-mouse in Blocks Area, "download Blocks as image")

Hi Chris,
thx for answering. let's simplify as my problem is similar to that topic https://community.appinventor.mit.edu/t/no-devices-found-during-ble-scan-on-android-10/13756/15 but with android 9.
if I m using this aix, .Android10BLETest.aia (187.3 KB) it doesn't work (while apparently it is working for android10 see this post No devices found during BLE scan on android 10

I did had a try with the :
BLE-with-extensions-api.aix
and
edu.mit.appinventor.ble-20200828.aix (latest release available)

Hi lenoyl

The Android 10 provisions do not apply to Android 9. Android 10 has many differences including a new collection of Google Security Measures which are the main "issue" for App Developers, including working with Bluetooth.

What is the Manufacturer/Model of your tablet?

Hi Chris,
it is the K107 Beista tablet with android 9.
I precise that the tablet is paired with the device, that is not the issue, just that it doesn't show up in the list with app inventor after the scan...
Any possible work around?
regards,

According to the manufacturer's specs, it's Android v5.1 Lollipop? It's pretty well guaranteed that you can't update from 5.1 to 9.

If it is Android 5.1, it just scrapes into the realm of BLE:
App Inventor BLE requires your device (e.g. SmartPhone) to have Android v5.0 or higher to avoid known issues with Google's Bluetooth LE support prior to Android 5.0.

The spec says it has Bluetooth v4.0, the very first version of BLE, first released in 2010, the most problematic version of BLE unfortunately.

The latest MIT BLE extension is the way to go. However, if it got into your Project as an update rather than being the very first version you used, the update may have silently failed. What to do:

  1. Save a backup of the Project to your PC
  2. Ensure the BackPack is empty
  3. Right-mouse click "Copy All Blocks to Backpack"
  4. Right-mouse click "Delete n Blocks" - App Inventor will have a panic attack and ask if you want to "Save the empty screen now" - yes you do.
  5. Go to the Designer, delete the Bluetooth Extension via the Extension Palette. App Inventor will have another panic attack and warn that all associated Blocks will be deleted too. The answer is OK.
  6. Import extension edu.mit.appinventor.ble-20200828.aix
  7. Return to the Blocks workspace, Right-mouse click "Paste All Blocks from Backpack"

Hi Chris,
Thx for your time to help me.
I confirm it is the K107 Beista tablet with android 9 on it (I checked - don' t ask me why and how they managed to do that...)

Will have a try with your procedure and will get back to you shortly.

I just had a try with the procedure, doesn t work. I also tried with a new simple small project from scratch with the edu.mit.appinventor.ble-20200828.aix release (see aia file enclosed)BLE_android9_test.aia (189.8 KB) . on my android 6 smartphone I can see the ble device but not with the android9 tablet :frowning:

Any other idea?

Do you receive regular Android 9 updates? There has been at least five this year.

hum ... it says that the system is up to date when I check for update .... but latest the update version looks suspicious:
BEISTA_vXA400009_20200106_20200106-2042

I suspect that the Android Version has been faked. However, for the purposes of your App, hopefully that should not matter.

I have just butchered some code I wrote for another AI2 User last night, for you to test. It must be tested as an APK, not via the Companion. It works for the other User but I have no Android v9 devices to test with today (house undergoing some renovations!). I have tested on v10 and it works.

Tips

  1. Do not run from the finished install panel displayed, run via the App Icon.
  2. If an eligible device is within 2-3 metres of your phone/tablet, it probably won't be found (Bluetooth flaw).

BleListDevices.aia (195.4 KB)

ok, I will let you know soon I have tested it.
thx,

Morning Chris,
I just tested your .apk: it just return me '' no device found'' and that's it! (I tested it with 10m between me and the BLE device...)

Assuming the Android version has been faked (most likely case) and it s running on a android 5.1: as you mentioned it is just at the start of the BLE era, has some one part of a BLE code that I can test knowing that is was working with a 5.1 Lollipop?

All these examples are tested on Meizu m3 note with Android 5.1 and Xiaomi Redmi 7 with Android 9

Hi lenoyl

It is well worth trying Juan's BLE example, he is an expert on this stuff.

It might be a good idea to try Classic BT too. You can try my Project here (near the end of the posts):

...which uses a Clock Timer to give BT a bit of time to complete it's scan in a similar way to my BLE example.

Hi guys,
Thx Juan for your help (I know KIO4 website and found some interesting stuff like the vertical slider ... just a pitty that there is no way to set the slider thumbposition to a certain value by pushing an other button - I finally found some in using Kodular- but anyway your website was really helpfull!)

Back to the problem: I had a try with Juan .aia and there is no list showing up with the BLE device after the scan. By the way I did try to compile it (to run a test without the compagnion), but get a long error message ....

Looks like I m going to have a try with an HC-05... I just got them few days ago.

Anyway, guys thx for your help and your time, we didn't manage to succeed this time, but maybe next one!

Hi lenoyl

It would help us if we could see that error message.