Hi, recently I am working a project using ionic 2 to detect each ibeacon in those 4 zone in the exhibition. Find that the native function ionic 2 can detect ibeacon, but how can i register 4 BeaconRegion in one application ? many thx !
We have used below code to get data from api calls and applying those beacons details to ibeacons. Try this one.
this.appService.getBeacons()
.subscribe(beacons => {
console.log(beacons);
var i=0;
for(i=0;i<beacons.length;i++){
// setup a beacon region – CHANGE THIS TO YOUR OWN UUID
this.region = this.IBeacon.BeaconRegion(beacons[i].beaconDetailes.beaconId,beacons[i].beaconDetailes.uuid);
this.region.NotifyEntryStateOnDisplay = true;
this.region.NotifyOnEntry = true;
this.region.NotifyOnExit = true;
// start ranging
this.IBeacon.startMonitoringForRegion(this.region)
.then(
() => {
resolve(true);
console.log("monitor for region");
},
error => {
resolve(false);
}
);
this.IBeacon.startRangingBeaconsInRegion(this.region)
.then(
() => {
resolve(true);
},
error => {
resolve(false);
}
);
}
}
);