iBeacon Plugin Issue

Hello, I’m working on a iBeacon App. I’m trying to call a Function as soon as a certain region is entered/ a certain beacon is detected. I can’t figure out in which part of the code I can call a function (setting a timer and output a message) I’ve used this tutorial:

import { Injectable } from '@angular/core';
import { Platform, Events } from 'ionic-angular';
import { IBeacon } from 'ionic-native';

@Injectable()
export class BeaconProvider {

  delegate: any;
  region: any;


  constructor(public platform: Platform, public events: Events) {
  }

  initialise(): any {
    let promise = new Promise((resolve, reject) => {
      // we need to be running on a device
      if (this.platform.is('cordova')) {

        // Request permission to use location on iOS
        IBeacon.requestAlwaysAuthorization();

        // create a new delegate and register it with the native layer
        this.delegate = IBeacon.Delegate();

        // Subscribe to some of the delegate's event handlers
        this.delegate.didRangeBeaconsInRegion()
          .subscribe(
          data => {
            this.events.publish('didRangeBeaconsInRegion', data);
          },
          error => console.error()
          );

          this.delegate.didEnterRegion(this.region)
            .subscribe(
              data => {
              this.events.publish('didEnterRegion', data);
            }
            );

        // setup a beacon region
        this.region = IBeacon.BeaconRegion('znmBeacon', 'E2C56DB5-DFFB-48D2-B060-D0f5A71096E0');

        // start ranging
        IBeacon.startRangingBeaconsInRegion(this.region)
          .then(
          () => {
            resolve(true);
          },
          error => {
            console.error('Failed to begin monitoring: ', error);
            resolve(false);
          },
          );

      } else {
        console.error("This application needs to be running on a device");
        resolve(false);
      }
    });

    return promise;
  }


}

Hello,

I solve my problem from this solution: https://github.com/petermetz/cordova-plugin-ibeacon/issues/264

Thanks