TAGS :Viewed: 7 - Published at: a few seconds ago

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

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



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