I'm currently trying to use a smartwatch LG G Watch R (fully updated) as a Beacon Scanner.
The Beacons are made by Estimote, so I'm using its SDK.
Using the smartphone I have no problem at all, but with the smartwatch I receive the signal from the beacons every 5 seconds despite having set both on the app and on the beacons the advertising time at 325ms.
The code is basically the same used on the smartphone.
Any ideas?
I don't know about the LG watch, but I realized similar behavior with other devices, like the Moto G2 for example. Even though the code is exactly the same, different devices handle it differently. It might be due to different chipsets used or how they are implemented.
Go to the logcat (without filtering the app) and look at the times when scans are started, stopped and when results are received. You might see that the scan process makes random "breaks" for no visible reason. Maybe it's the same issue with your watch.
Unfortunately I don't know about a solution.
Related
My issue is that iOS and various android phones receive number of BLE advertise packet from specific ibeacon, for example In 5 minutes from a specific beacon iOS receives about 904 advertise packets and android phones receive about between 230 to 480 depending on the phone.
Does anyone know if there is a setting that can set scanning rate of the BLE module? If not what else might cause this issue?
I use "CBCentralManager" to utilize BLE module in iOS and "blutoothLeScanner" in Android.
//Creating an instance of CBCentralManager
private let bluetoothManager = CBCentralManager(delegate: nil, queue: nil)
//Start Scanning
bluetoothManager.scanForPeripherals(withServices: nil, options: [CBCentralManagerScanOptionAllowDuplicatesKey:NSNumber(value: true)])
The scan parameters are hardcoded in both OSs, but on Android you can choose between the following three modes:
https://developer.android.com/reference/android/bluetooth/le/ScanSettings.html#SCAN_MODE_BALANCED
https://developer.android.com/reference/android/bluetooth/le/ScanSettings.html#SCAN_MODE_LOW_LATENCY
https://developer.android.com/reference/android/bluetooth/le/ScanSettings.html#SCAN_MODE_LOW_POWER
Note that if you scan in the background, SCAN_MODE_LOW_POWER will be used regardless of what you select.
There is a large amount of variation between Android device models (often called fragmentation) and this applies to the Bluetooth LE behavior as much as anything. Differences between Android phones is a more likely explanation for the discrepancies you see than the scan rate, which defaults to a 100% duty cycle (LOW LATENCY) on all Android devices I have seen, and is similar to iOS.
Given the same conditions, some Android devices scan a similar number of BLE advertisements in iPhones (e.g. Pixel and later Nexus 5+ devices.) But not all Android devices provide as good of results.
You don't say specifically which Android models that you tested which saw fewer advertisement detections, but there are a number of things that might cause this:
Some older Android devices like the Nexus 4, Nexus 7 and Moto G (1st generation) would only detect on advertisement per scan per unique bluetooth device. Restarting the scan was needed to detect a second packet from that device. You might try restarting your BLE scan every second or so to see if this helps.
Some Android devices like the Huawei P9 have very poorly performing BLE antennas, so they are rarely able to detect BLE devices at more than 10 meters, whereas iPhones typically detect at 40-50 meters or more. You can see if this is the cause of your issue by looking at the signal level (RSSI value) for packets received. Are the RSSI values consistently weaker (more negative) on the Android device vs. iOS? If so, then this explains the discrepancy.
I know the same behaviour from some phones.
Note that your peripheral probably does advertising on 3 BLE channels. (?) It might be possible that your Android device only listens on one channel.
Moreover and on some cases even worse, it is possible that your phones listens on one channel at a time and another channel some time later, thus, also does channel hopping for scanning. It is possible that you get aliasing effects and see the advertising only a few times. This is why the Apple Accessory Guide recommends certain advertising intervals of the peripheral. (chap. 23.5)
I'm currently having issues with Samsung Devices running Android Pie.
My App is using a foreground service with an active notification. Once a geofence is entered I'm scanning for a bluetooth beacon.
This works on all devices across all Android versions (also used to work on Samsung devices running oreo).
The problem begins after entering the geofence.
It seems like the system prevents the bluetooth scan from starting as long as the display is black.
Once I press the power button (without unlocking or even opening the app) I see the scan results coming in.
I'm already using scan filters since this led to the same problem on all android devices after updating to oreo.
Has anybody experienced the same issue or could point me in the right direction?
Kind regards
I wrote and app using kontakt.io api and examples for beacons.
This app correctly work on Sony Xperia SP, but when I use different models of HTC smartphones (like HTC Desire 820) this app work really slowly (active time for scanning is 3 seconds, for passive scanning - 2 seconds).
If I use Bluetooth scanning on the HTC (via settings of smartphone) - I had same problems. Very slow work (slow scanning).
Can somebody explain, why is so? Maybe this problem is only on HTC?
Disclaimer: I work for Kontakt.io, although not as an Android developer
Unfortunately the biggest strength of Android, its openness and variety, is IMHO also a source of the weakness that you see right now. Different manufacturers use different Bluetooth chipsets, antennas, etc. in their devices. All of the possible combinations usually work in typical Bluetooth use cases, like connecting to Bluetooth speakers, keyboards, etc., but some of them fail when something more is required (e.g. scanning beacons).
In my experience latest Samsung flagships are pretty reliable, but e.g. OnePlus phones have a lot of problems with beacons. Similarly, Nexus 5 is one of the best Android phones when it comes to working with beacons, but Nexus 5X really struggles with detecting them. You've mentioned Sony Xperia SP, that it works OK, but we had Xperia Z (don't remember the exact model, sorry) and it was horrible. Apparently your HTC falls into the Bad BLE category :-(
This is a prioprietary software, so you should ask Kontakt SDK developer.
From my side I would suggest a following thing: check Android version system both devices operate on. BLE Android API was introduced in Android 4.3 and got huge refactor in Android 5.0. So this maybe the case of slow scanning.
Also take into consideration, that BLE devices do not broadcast their presence all the time, as one of their purposes is very low battery usage.
Would a Bluetooth LE Jedi know any trick how to get a reliable BLE scanning mode on cheap Android 4.4 devices ?
Everything works fine from Android 5 to 6, and most of the Android 4.4 phones...
However, on some cheap phones with 4.4 we encounter random issues, some phones do not detect anything, or sometimes just a few beacons among others, depending on environment, daytime, weather, or whatever... It's obviously due to a poor software or hardware on this side, but is there any trick to make it more stable programmatically ? (for example enabling / disabling Bluetooth regularly)
EDIT
To describe a typical behavior:
First, note that it is the exact same behavior with all scanning Apps I could test (Estimote, Kontakt.io, AltBeacon, etc. etc.) - so this is much probably not a matter of App implementation.
It occurs only below Android 5 (4.4.2, 4.4.3, 4.4.4) and on cheap devices, never on phones like a Samsung S5 for example.
The behavior: let's assume we have 5 beacons very close (less than 2 meters, all working fine).
- Once rebooted the phone finds 5 beacons for 1 or 2 minutes.
- Then it finds nothing for 5 minutes.
- After a refresh it finds 2 beacons.
- Another refresh of the scan: only 1 found. Then none... etc.
I could not find any logic, for now it looks erratic.
Enabling / disabling Wifi / Bluetooth, Bluetooth+Wifi, Wifi then Bluetooth, etc. make sometimes the scan find one more beacon, sometimes not... there is probably not much difference if I just wait without changing those params.
The only way to get back a reliable scan is to reboot the device... then it works only for 1 or 2 minutes again...
It occurs on some very different devices (a Wiko Sunset, a Samsung XCover, an Orange Roya).
On more recent devices (Nexus 6, Samsung S5, Samsung A4...), 100% of the beacons are detected, for hours, and never lost.
So, as the complete reboot is actually the best solution to get all beacons detected I was wondering if there is a way to "refresh" the device's Bluetooth module without rebooting it... Or if we just have to become a philosopher about this ;-)
if you are develop your application using node.js then there are many api's avaliable which may work for you.But in case of android it is totally depend on your android version
The beacons (QUALCOMM/Gimbal beacons) worked fine unitl yesterday. Since yesterday I have not been receiving any signal from those beacons neither in my app nor in another Android App "Bluetooth LE Scanner" (LG G2 mini) nor in another iPhone app "Beacon Scanner" (iPhone 5).
I created a test configuration in my https://manager.gimbal.com account. When trying to flash the concerned iBeacon it still dosn't get detected.
Battarystate of beacons is OK.
Anybody any ideas or similar experiences?
It is solved - Thank you Ian.
Maybe the problem were the batteries - I replaced all batteries and aditionally configured a brand new Gimbal-beacon in the Gimbal-manager.
But how likely is it that the batterie-state of 5 Gimbal-beacons went critically within such a short time (more or less "at once").
Nevertheless - beacons are up and running again.
Note1: After the beacons went offline yesterday I started the development-iPhone5 (it's not used regularly) and it said:
"Beacon Mgr has been using your location in the background. Do you want to continue allowing this? This is required in order to see your Gimbal beacons."
I clicked "Continue" in this popup.
Note2: I contacted the Gimbal-support from directly out of the https://manager.gimbal.com - Platform.
Maybe this also had some influence.