For an Ionic (4) project I try to scan for iBeacons on an Android device. The sample code I use is the same as described in the documentation, except the UUID and the identifier (I checked those and they look correct).
delegate.didEnterRegion()
.subscribe(
data => {
console.log('didEnterRegion: ', data);
}
);
let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','F7826DA6-ASDF-ASDF-8024-BC5B71E0893E');
this.ibeacon.startMonitoringForRegion(beaconRegion)
.then(
() => console.log('Native layer received the request to monitoring'),
error => console.error('Native layer failed to begin monitoring: ', error)
);
It all looks like its working well as it reach the didEnterRegion() with the following data:
eventType: "didEnterRegion"
region:
identifier: "my_identifier"
typeName: "BeaconRegion"
uuid: "my_id"
The only problem is that the return value (IBeaconPluginResult) is not the same as described in the documentation (https://ionicframework.com/docs/v3/native/ibeacon/#IBeaconPluginResult), as its missing the array of beacons.
Also I implemented the didRangeBeaconsInRegion delegate, but it never reaches the callback.
delegate.didRangeBeaconsInRegion()
.subscribe(
data => console.log('didRangeBeaconsInRegion: ', data),
error => console.error()
);
I also downloaded the Locate Beacon app from the Google Play Store which detects the beacon.
What am I doing wrong? Am I missing something?