hello friends,
I am working with iBeacon Native, all working fine with single beacon.
but I CAN’T TRACK MULTIPLE BEACONS at same time. :(
delegate: any;
region: any;
beaconUpdate: any;
mybeacon : any = [{identifier : 'ionBeacon', uuid:'74278bda-XXXX-XXXX-XXXX-720eaf059935',
major: 65504,minor:65505,notifyEntryStateOnDisplay: true },
{identifier : 'ionBeacon', uuid:'e2c56db5-XXXX-XXXX-XXXX-d0f5a71096e0',
major: 0,minor:0,notifyEntryStateOnDisplay: true }
];
ionViewDidEnter() {
console.log('ionViewDidEnter');
this.fnScan();
}
fnScan(){
if (this.platform.is('cordova')) {
// Request permission to use location on iOS
this.ibeacon.requestAlwaysAuthorization();
if(this.mybeacon.length > 0){
//========= setup a beacon region ========
this.mybeacon.forEach(bcn => {
let region = this.ibeacon.BeaconRegion(bcn.identifier, bcn.uuid, bcn.major, bcn.minor, bcn.notifyEntryStateOnDisplay ); //
//============== start ranging ============
this.ibeacon.startRangingBeaconsInRegion(region);
this.delegate = this.ibeacon.Delegate();
this.delegate.didRangeBeaconsInRegion(this.mybeacon)
.subscribe(data => {
this._ngZone.run(() => {
let bcndata = data;
if(bcndata.beacons.length > 0 ){
this.beaconUpdate = bcndata.beacons;
}
});
});
});
}
}else {
this.iBeaconTost('This application needs to be running on a device', 'Adnroid/iOS');
}
}
<ion-card class="card" *ngFor="let bcn of beaconUpdate">
<h1> {{bcn.uuid}} </h1>
<ion-row >
<ion-col col-8 text-left>
<a no-padding><b> rssi : </b>{{bcn.rssi}} </a><br/>
<a no-padding><b> accuracy : </b>{{bcn.accuracy}} </a> <br/>
<a no-padding><b> proximity : </b>{{bcn.proximity}} </a>
</ion-col>
<ion-col col-4 text-right>
<a no-padding><b> major : </b>{{bcn.major}} </a><br/>
<a no-padding><b> minor : </b>{{bcn.minor}} </a><br/>
<a no-padding><b> tx : </b>{{bcn.tx}} </a>
</ion-col>
</ion-row>
</ion-card>
thanks.