SparkFun Forums 

Where electronics enthusiasts find answers.

Everything with the AmbiqSuite SDK tools and software are welcome here.
User avatar
By giliy
#213308
Hi,
I've been trying to use the Artemis Nano with its BLE featues and my Android Q (Samsung Galaxy S9) with various examples with no luck. I've tried the amdtp, the BLE Blink LED example, I've even built my own makefile with a Tag profile. Nothing works.
1. Whenever I'm trying to scan for devices, I get no results [Android: btAdapter.getBluetoothLeScanner().startScan()].
2. I sometime manage to see the device when I scan them using the phone's Bluetooth scanning menu but it only pairs.
3. Using the nRF app I'm trying to connect to it [Android: myBLEDevice.connectGatt()] but getting error message 257 and "Device disconnected"
Is it Android Q's fault? Something incompatible here? Anyone had these kind of issues?
Thanks!!
User avatar
By Zoe333
#213310
A quick note: it helps if you’re at least familiar or somewhat comfortable with Android BLE-related APIs, and have attempted to write an Android app that communicates via BLE. But, if you don’t have any experience whatsoever, feel free to keep reading and see why BLE development on Android isn’t as scary as most people think.
Tip 1: Target a minimum API level of 21
Tip 2: Don’t perform BLE operations in rapid-fire succession
Tip 3: Handle error codes in the BluetoothGattCallback interface
Tip 4: Don’t rely on usages of private APIs shown in old example code
I hope this helps!
User avatar
By giliy
#213312
Thanks for the prompt answers!
Yes. Location permission is on.
Changed API level to a lower one (25, 21 gives me issues). Still, scanning results nothing.
I currently do *nothing* else. Even the scanning does not work. Neither with my app nor with the nRF one. Just using the generic Android system Bluetooth scan I am able to see and pair the device. But nothing else.
User avatar
By liquid.soulder
#213313
I haven't had these kinds of problems with a Moto Z or Pixel 3 - can't rule out the Q but I would not suspect it for any particular reason.

I'm sorry I don't have any specific advice but I would like to point you toward a helpful BLE thread by users KHE and paulvha.
viewtopic.php?f=168&t=52326&sid=0d9fa32 ... 7&start=15

paulvha has a very good demo of BLE on the Artemis here: https://github.com/paulvha/apollo3
User avatar
By giliy
#213381
Thanks everyone!
The issue was with the Galaxy S9 phone. I don't know whether it's the phone itself or the recent upgrade I did for the latest Android but something in that mix screwed things up.
Anyway, on a different phone (Sony Xperia Compact XZ 2, Android 10) everything works properly.
User avatar
By Zoe333
#213678
BLE support was added to the Android SDK back when Android 4.3 (Jelly Bean, API level 18) was released, but our experiences with BLE on Android 4.3 and 4.4 (KitKat, API level 19) had been less than ideal: there were threading issues in the BLE scan callback that developers had to work around by manually juggling threads (which is always a bad idea), and certain Samsung and LG devices required a restart of their Bluetooth radios to kick-off a BLE scan that had previously been stopped. We also tried to filter scan results by service UUID using the provided API method, but the scan simply stopped returning results altogether.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum