I’m using ionic native IBeacon.I want to check if my device can see a ibeacon when user clicks a button.And I want to pass data to event handler ,just like this in my code ;
> CheckinButtonClick(id,checkinTime)
> {
> this.nativeStorage.getItem("password").then(
> mydata => {
> // I want to pass mydata to event handler "mySubscribedHandler"
> this.events.subscribe("didRangeBeaconsInRegion", this.mySubscribedHandler );
> }
> }
>
> mySubscribedHandler:any = (data) => {
> var isfound = false;
> this.beacons = [];
> let beaconList = data.beacons;
> beaconList.forEach((beacon) => {
> // i will check if my device can see a specific beacon i found=true
> if(isfound)
> {
> // i will call a rest service
> }
> });
> // and i will unsubscribe the event
> this.events.unsubscribe("didRangeBeaconsInRegion",this.mySubscribedHandler);
>
> }