cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
264 stars 318 forks source link

Get a transistion without device notification #247

Open RonaldVanAken opened 6 years ago

RonaldVanAken commented 6 years ago

Hi there,

I am using the component in ionic2 but only want to catch the onTransistion event and avoid any notifications sent to the user.. Are there parameters i can use for that?

Thanks!

crabbydavis commented 6 years ago

I am also very interested in knowing if this is possible. I would like to run some code when the onTransition event happened without having to send a notification.

RonaldVanAken commented 6 years ago

I do not think its possible in the current code base. It should not be a major thing to add to the existing code. If i come around to doing that i will submit the changed code to the author.

lionogueira commented 6 years ago

Hi guys @RonaldVanAken @crabbydavis ,

It is possible to listen to transitions without sending notifications. Just remove the notification property when adding the point.

ie:

window.geofence.addOrUpdate({
    id:             String, //A unique identifier of geofence
    latitude:       Number, //Geo latitude of geofence
    longitude:      Number, //Geo longitude of geofence
    radius:         Number, //Radius of geofence in meters
    transitionType: Number //Type of transition 1 - Enter, 2 - Exit, 3 - Both
}).then(function () {
    console.log('Geofence successfully added');
}, function (error) {
   console.log('Adding geofence failed', error);
});