Hello All, i am very new to ionic, just started to do some projects. Need a lot of help ;D . I have this code i just write.
import { Component } from ‘@angular/core’;
import { IBeacon } from ‘@ionic-native/ibeacon/ngx’;
import { Platform } from ‘@ionic/angular’;
@Component({
selector: ‘app-home’,
templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
})
export class HomePage {
constructor(public platform: Platform, public ibeacon: IBeacon) { }
startScanBeacon() {
this.ibeacon.requestAlwaysAuthorization();
const delegate = this.ibeacon.Delegate();
delegate.didRangeBeaconsInRegion()
.subscribe(
data => console.log(‘didRangeBeaconsInRegion’, data),
error => console.error()
);
delegate.didStartMonitoringForRegion()
.subscribe(
data => console.log('didStartMonitoringForRegion: ', data),
error => console.error()
);
delegate.didEnterRegion()
.subscribe(
data => {
console.log('didEnterRegion: ', data);
}
);
const 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)
);
}
}
But it shows this error :
Please Help,