cowbell / cordova-plugin-geofence

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

onTransitionReceived() not called for exit region in cordova #292

Closed kumar-kondiker closed 5 years ago

kumar-kondiker commented 5 years ago

Hi all, I am using geofence plugin for cordova app I m getting called onTransitionReceived callback method when user at current region if user croses the region onTransitionReceive not getting called.

Code

`

function onDeviceReady() {

  window.geofence.initialize().then(function () {

}, function (error) {
    alert("Error", error);
});

let fence = [{
    id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdb",
    latitude: xx.956786,
    longitude: xx.743058,
    radius: 1000,
    transitionType: 1,
   notification: {
               id: 11,
               title: "Welcome!",
               text: "You're in.",
               openAppOnClick: true
           } 
}, {
    id: "69ca1b88-6fbe-4e80-a4d4-ff4d3748acdc",
    latitude: xx.956786,
    longitude: xx.743058,
    radius: 1000,
    transitionType: 2,
     notification: {
               id: 22,
               title: "bye!",
               text: "You're out .",
        openAppOnClick: true
           } 
}]

window.geofence.addOrUpdate(fence).then(function () {
    //alert(JSON.stringify(geofences));
    navigator.notification.alert('successfully added', function () { });    
}, function (reason) {

    navigator.notification.alert('failed', function () { });
})

window.geofence.onTransitionReceived = function (geofences) {  

    geofences.forEach(function (geo) {
        alert("geo " + JSON.stringify(geo));
     });
   };

};`

Any help would be really appreciated

MeeranRM commented 5 years ago

I too have the same issue. Any help would be appreciated