Detect proximity using Bluetooth LE “Proximity” profile Android

天大地大妈咪最大 提交于 2019-12-03 02:48:28
Shobhit Puri

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.

Simon Wiesmann

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.

shubham jain

Unfortunately, the android can only act as central not peripheral. So custom profiling is not possible at this point of time. Rather you can use the profile which are being provided by gatt.

For example: Temperature Monitor profile. Instead you can make the custom service and characteristics on iPhone and make it work as beacon.

Also if you are using hardware device of Estimote and other companies, you can reply back the data from android device i.e Services and characteristics have the properties such as Read, Write and Notify. But when you are making iPhone as Beacon, then you won't be able to receive the value from android device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!