Когда я добавляю геозону, в моем проекте я установил какую-либо конкретную долготу широты, как я могу проверить, вхожу ли я в геозону или выходить из нее.
private addGeofence() {
let fence = {
id: '69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb', //any unique ID
latitude: 20.115617, //center of geofence radius
longitude: 73.859157,
radius: 100, //radius to edge of geofence in meters
transitionType: 3, //see 'Transition Types' below
notification:
{ //notification settings
id: 1, //any unique ID
title: 'You crossed a fence', //notification title
text: 'You just arrived to Gliwice city center.', //notification body
openAppOnClick: true //open app when notification is tapped
}
}
this.geofence .addOrUpdate(fence).then(
() =>{
console.log('Geofence added')
this.CheckGeofenceTansition();
} ,
(err) => console.log('Geofence failed to add')
);
}
CheckGeofenceTansition()
{
console.log("geofence on transition recieved Method Called");
if(this.geofence.onTransitionReceived())
{
alert("you are in geofence")
this.navCtrl.push(NavigationMenuPage)
}
else{
alert("you are out of geofence");
}
}