Problem definition:
I've been trying to use BLE proximity profile
for Bluetooth LE on Android. Some of the devices like new generation Google Nexus tablet with 4.3 Android support BLE and can act as a central
device.
I read the Android official documentation of the Bluetooth LE but their doesn't seems any support for that. Is their any workaround to implement our own proximity profile?
Questions which talk about proximity profile on Android but are of no help
Any help is appreciated. Thanks.
Bluetooth signals can be used to detect whether or not beacon and receiver device are in proximity of each another; however, the manner in which they operate means their proximity detection does not correspond to consistent, fixed spatial distances [12].
To find BLE devices, you use the startScan() method. This method takes a ScanCallback as a parameter. You must implement this callback, because that is how scan results are returned.
Once your app has permission to use Bluetooth, your app needs to access the BluetoothAdapter and determine if Bluetooth is available on the device. If Bluetooth is available, the device will scan for nearby BLE devices.
Bluetooth Low Energy is a power-conserving variant of Bluetooth personal area network (PAN) technology, designed for use by Internet-connected machines and appliances. Also marketed as Bluetooth Smart, Bluetooth LE was introduced in the Bluetooth 4.0 specification as an alternative to Bluetooth Classic.
June 2014:
Thanks everyone for the answers. Just to update, as of June 2014, BLE Peripheral mode is offered in the Android L Developer preview. So now Android devices can act both in peripheral and central role. Hope to see it in the Android L
official release. Quoting from their blog New in Android: L Developer Preview and Google Play Services 5.0:
The L Developer Preview, lets you explore many of the new features and capabilities of the next version of Android, and offers everything you need to get started developing and testing on the new platform. Here are a few of the highlights for developers:
BLE Peripheral Mode — Android devices can now function in Bluetooth Low Energy (BLE) peripheral mode. Apps can use this capability to broadcast their presence to nearby devices — for example, you can now build apps that let a device to function as a pedometer or health monitor and transmit data to another BLE device.
Update 16th October 2014:
Its out now! Checkout Android 5.0 wireless changes page.
Update 8th December 2014:
The bad new is that BLE Peripheral mode will only work on the newer Android devices (as per the date), viz Nexus 6 and Nexus 9. It won't work on Nexus 4/ Nexus 5/nexus 7/ nexus 10 even if you update it to Android 5.0. You can read the comment by one of the Android Project manager on BLE advertise mode not working ticket. He says:
We introduced BLE peripheral mode in Android 5.0 Lollipop. Nexus 6 and Nexus 9 are the first two production Nexus devices that support BLE peripheral mode. Due to hardware chipset dependency, older Nexus devices (4/5/7) will not have access to the feature on Lollipop.
Thanks to Rob Anderson for informing.
To elaborate on shubhams's answer:
Unfortunately there is no way for Android devices to act as a peripheral. He can creates GATT servers, services and charachteristics but there is no way to make the advertising. (https://stackoverflow.com/a/18020153/3061383)
Since Android does not (yet) support advertising no other BLE device is able to initiate a connection to an Android device. As of now the Android device must initiate the connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With