Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect proximity using Bluetooth LE "Proximity" profile Android

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

  • Reading Bluetooth RSSI for BLE proximity profile in Android.
  • How to use the profile of PROXIMITY PROFILE,IMMEDIATE ALERT SERVICE and Find Me Profile in android 4.3 BLE?
  • BTLE (Bluetooth Low energy) development kit - must have proximity profile

Any help is appreciated. Thanks.

like image 885
Shobhit Puri Avatar asked Oct 28 '13 16:10

Shobhit Puri


People also ask

Can Bluetooth detect proximity?

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].

How do I scan my Android phone with BLE?

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.

How do I enable BLE on android?

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.

What is Bluetooth LE device?

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.


2 Answers

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.

like image 136
Shobhit Puri Avatar answered Sep 16 '22 15:09

Shobhit Puri


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.

like image 25
Simon Wiesmann Avatar answered Sep 18 '22 15:09

Simon Wiesmann