Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Ionic 4 ibeacon

$
0
0

@Hasifi wrote:

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,

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>