How to scan all nearby ibeacons using coordova based Hybrid application?

丶灬走出姿态 提交于 2019-12-13 12:24:03

问题


I am planning to develop a hybrid application that will scan ibeacons , can you please point me to right cordova plugin that has this facility?

I was referring to petermetz/cordova, but it seems it doesn't have scan facility

I am NOT using Angular JS, so please don't refer to ng plugins

Thanks,

Rohit


回答1:


Yes, the cordova-plugin-ibeacon is the one to use. It does support scanning for beacons, although the examples don't make this obvious. Check out the "Start ranging a single iBeacon" example. The only difference between looking for a single beacon and lots of beacons is that you set the identifiers to null to look for any identifier as a wildcard. Like this:

var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(identifier, uuid, null, null);

The line above will set up a region that you can use to find any major and minor value for a beacon with the specified ProximityUUID.

This brings up an important distinction between Android and iOS. On iOS, you must supply a ProximityUUID (the second parameter to the method shown) and it is impossible to scan for all beacons regardless of ProximityUUID. On Android, you can supply null for that parameter, effectively allowing you to scan for any beacon. To be clear, this is not a plugin-specific limitation on iOS. It is an operating system limitation.



来源:https://stackoverflow.com/questions/38580410/how-to-scan-all-nearby-ibeacons-using-coordova-based-hybrid-application

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