AltBeacon library with Bluetooth 5 (beacon detectable range) - android

I'm using the Altbeacon library currently.
I used ADVERTISE_MODE_LOW_LATENCY and ADVERTISE_TX_POWER_HIGH for the transmitter app, and my device supports Bluetooth 5. So I guessed the beacon should be detectable in about 30~50m range. However, the beacon was detected in about 5~7 meters instead of the expected range.
All I want to ask is, As far as I know, Bluetooth 5.x is a standard that extends the communication range, so why are beacons still only detected within 6-7 meters? There is an any option for extend detectable range in BeaconManager?

A few points:
Bluetooth 5 is largely a marketing term. Just because a device says it supports Bluetooth 5 doesn't mean it supports all "optional" features. I learned this the hard way when trying to program a Raspberry Pi 4 with BLE 5. Long range advertising is an optional feature.
When it comes to long range advertising, the specific feature you are talking about is called Coded PHY. This is a physical layer that uses hamming codes for forward error correction. This is what enables advertising to be detected at long range despite the same radio power.
The Android Beacon Library's transmitter and scanner do not use long-range BLE 5 features even if the device hardware and bluetooth stack supports it. The reason we have not put support into the library for this is because there remains very little opportunity to use this feature -- iPhones do not support it, very few hardware beacons support it, and even many newer Android devices do not support it.
Android 8.0+ has APIs to enable this. You want to use PHY_LE_CODED for both advertising and scanning. To play with it, you'll need to phones that support PHY_LE_CODED. Read more here: https://source.android.com/devices/bluetooth/ble_advertising

Related

Difference in ble scan rate in Android vs iOS

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)

How can I make my Android application to act as a Beacon?

I want to develop two Android applications out of which one application should act as a Beacon. That is, one of my application installed in one device should listen certain events from the other app installed in other device and should broadcast some information on listening those events.
I read many articles and I found that the Android device must have Bluetooth LE hardware and it must have peripheral mode enabled by the device manufacturer. But most of the manufacturer as well as Google itself has disabled peripheral mode.
So my question is there a way (a Beacon library available?), so that I can make my application to act as Beacon.
Thanks in Advance.
You can use the Android Beacon Library to make a device both transmit as a beacon and detect/decode beacon transmissions.
It is true that devices must have BLE hardware for this to work, Android 4.3+ to detect beacons and Android 5.x+ to transmit as beacons. While not all devices with 5.x+ support peripheral mode needed to transmit, most popular devices do. Google has not disabled this, and their newer Nexus and Pixel devices support transmission as well.
The library linked above has a list of devices known to support transmission, and includes example code showing how to determine this at runtime on a specific device.
If a device does not support peripheral mode, there is nothing you can do short of rooting the device and trying to write a new Bluetooth driver yourself.

iBeacon, AltBeacon, *Beacon: What interoperability is legal, and permitted on iOS and Android?

I want to support only one Beacon standard if possible, and have the device itself act is the "host/beacon", and other devices the "listener".
I'm supporting Android, iOS, and possibly Windows phone using Xamarin.
Is any interoperability supported between iOS and android?
The AltBeacon standard is precisely designed to allow the interoperability you suggest. It supports using the same 16/2/2 byte identifier scheme. Radius Networks (my company) sells RadBeacon USB units that have a dual advertisement that interleaves an AltBeacon transmission with an iBeacon transmission. This allows you to set up the beacon once with a single identifier scheme and use the AltBeacon advertisement for detection on Android devices and the iBeacon advertisement for detection on iOS devices. The open source Android Beacon Library 2.0 allows Android to get full beacon functionality similar to CoreLocation on iOS.
This is the most conservative approach for interoperability, because it does not rely on using Apple's iBeacon technology on Android devices. That said, Android devices are technically capable of detecting and decoding iBeacon signals. Configuring the Android Beacon Library to do this brings up issues of intellectual property that I am not qualified to answer.
For Windows devices, the operating system does not allow for detecting Bluetooth LE beacons as of Windows 8.1 (either mobile or desktop versions). This is expected to change in Windows 10, but that will not come until late 2015.
Check this library to give you some guidance.
https://github.com/AltBeacon/android-beacon-library
It allows Android devices to use beacons much like iOS devices do. An app can request to get notifications when one or more beacons appear or disappear. An app can also request to get a ranging update from one or more beacons at a frequency of approximately 1Hz.
You can also find more information on this blog:
http://vincenth.net/blog/archive/2014/04/24/building-cross-platform-ibeacon-apps-for-ios-android-and-windows-with-c-and-xamarin.aspx

Mimicking NFC with iBeacon: plausible? appropriate?

I'm creating an app in which a key piece is transferring data when two people press a button on the app on their respective devices and then press their phones together (Yes, Bump on Android does this. That isn't the point). I know I could use NFC on Android to get this done. However, I wouldn't be able to do this on iOS because iOS doesn't support NFC. Earlier today I read about and discovered iBeacon, which is apparently some Bluetooth 4.0 implementation that works with both iPhones and Android devices. I've read about retail use-cases of iBeacon, where stores could set up beacons and when users walk by or are close enough, it'll trigger an action. Is the use-case of mimicking NFC for my purposes to be able to do reach iPhone users plausible? Should I be using another solution? Is this not the purpose of iBeacon and it wouldn't work?
From my experience with iBeacon on Android, you can indeed use it to replace NFC, as there are 3 'ranges' (immediate, near and far). iBeacon is based off BLE (Bluetooth Low Energy) and very light on power consumption as the name would suggest.
If you are trying to trigger actions on devices in a certain vicinity, i'd say using iBeacon is the most plausable method.
Android doesn't natively support 'iBeacon' as Apple created it, but it is based off Blueooth 4.0, a library has been created to mimick the iOS implementation of iBeacon
Android iBeacon Library
One thing to note, is that when using iBeacons, you cannot transmit data. Only two numbers (a major, and minor) and a UUID used solely for identification purposes.
The main problem with using iBeacons for this is that iBeacons are transmit only devices designed only to alert phones to their presence. The technology cannot exchange data.
You could do something like you describe with low-level programming with Bluetooth LE technologies, but iBeacons alone cannot do the job.

Is it possible to use a BLE enabled Android/iPhone as a BLE beacon?

I'm working on a BLE proximity sensing feature based on Android and need some information.
Currently I see there are no BLE beacons manufacturers for android. I found 2 so far for iPhone.
1) http://www.estimote.com
2) http://www.gimbal.com
Estimote claims that their devices are generic but mainly they are publicized for iBeacons. So I'm not sure whether I should order them for a feature on Android.
Secondly gimbal explicitly mentions that their devices won't be enabled for android for proximity sensing.
So if any of you know where can I order BLE beacons compatible with Android please let me know.
Another thing, for prototype testing I was wondering whether I could use a Android BLE capable tablet or smartphone as a beacon to emit BLE signals?
Till now the documentation for android only suggests how to detect a beacon, But I'm not sure whether an Android device can be used as a beacon.
Any insights?
There is a BLE Beacon manufacturer for Android: Radius Networks
You can detect any standard iBeacon on Android using our Android iBeacon Library.
You can try it out yourself with our free iBeacon Locate app, which is based on this library. My company also sells both software and hardware iBeacons that I guarantee work with Android. But again, any standard iBeacon will work, too. Don't take my word for it -- just download our free app and use it to see one of our iBeacons. (We even have a free virtual machine you can use!)
It is currently not possible to make an iBeacon out of a stock Android device because the Bluetooth LE APIs, introduced in Android 4.3, do not support the peripheral mode needed to transmit advertisements like an iBeacon.
EDIT: It is now possible to make rooted Android 4.4.3 devices transmit as an iBeacon. See here.
I tried simple BLE scan app on Android, but the callback for LeDevices always returned null for UUID[]. Also, finding based on know UUID didnot work.
To add to David's reply. I have tried Radius Networks SDK, pretty clean. I like it.
Also, Estimotes has released their Android SDK today(1/7), which is good. The sample App shows notification, Distance, Major-Minor. I tested with 3 Estimotes & also with iPhone's app (making the iPhone as iBeacon). It works well, give it a try.
Note that you have to modify the code
change the ESTIMOTE_PROXIMITY_UUID value to the UUID that you are watching for.
Hope it helps.

Categories

Resources