How to get battery level of Kontakt ibeacons

☆樱花仙子☆ 提交于 2019-12-01 01:30:45

If your beaconlayout expression is correct for that beacon, then you can read the battery value for the d25-25 data field with:

long batteryLevel=beacon.getDataFields().get(0);

See documentation for reading data fields here:

http://altbeacon.github.io/android-beacon-library/javadoc/org/altbeacon/beacon/Beacon.html#getDataFields()

However, the first link in your question mentions the field is in the "scan response" of the beacon. If that statement is true and not a misstatement, that means the battery level is not in the advertisement at all, so you will not be able to get it without separately polling for this info.

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