Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

android - Can a HTC advertise itself as a BLE Beacon?

Ive been doing some work around BLE and iBeacons. At present I'm aware that you can turn your iPhone into an iBeacon but I have not come across any details of whether this is possible with an Android phone - specifically a HTC One as that the one I've got ;)

Any advice, details or web links on this matter would be appreciated,

Thanks,

Steve

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Android devices have a public APIs to transmit BLE advertisements only starting with Android 5.0. You would need to install this operating system on your HTC One to do this in a regular app. I have made an app that transmits with the intellectual property-free AltBeacon standard, and put it in the Play Store here.. Source code is available here. Again, you need Android L for this to work.

Alternatively, Android 4.4.3 also has hidden APIs that allow transmitting BLE advertisements. Building a transmitter app against 4.4.3 has three challenges:

  1. You must manually compile a special version of the Android SDK from source to unlock the hidden APIs so you can build your app.

  2. The permissions needed to transmit in 4.4.3 require system privileges,
    So you have to root your phone to install it in as special location. This makes it impractical to distribute such an app in the Play Store.

  3. A bug in 4.4.3 limits the length of advertisements to one byte less than needed to transmit a 20 byte beacon identifier and a one byte reference tx power value. This means you have to leave off that latter field making it impossible to "range" or estimate distance to the transmitter from other devices.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...