cowbell / cordova-plugin-geofence

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

onNotificationClicked not giving any Data #274

Closed asangadev closed 6 years ago

asangadev commented 6 years ago

Hi guys,

Need some help here. I'm running below on deviceready function.

The PUSH messages works perfectly fine. But I'm not getting the data back on app load via PUSH click. Can someone please help?

var person = {
       firstName : "John",
       lastName  : "Doe",
       age       : 30,
       eyeColor  : "blue"
};
 window.geofence.addOrUpdate({
            id:             "0000",
            latitude:       -48.112892927331245,
            longitude:      165.24934367326853,
            radius:         1000,
            transitionType: TransitionType.ENTER,
            notification: {
                id:             1,
                title:          "Welcome Home",
                text:           "You just arrived home.",
                openAppOnClick: true,
                data: person
            }
        }).then(function () {
            console.log('Geofence successfully added');
            $('#output').text('Geofence successfully added');
        }, function (reason) {
            console.log('Adding geofence failed', reason);
            $('#output').text('ERROR: ' + reason);
        });
window.geofence.onNotificationClicked = function (notificationData) {
    console.log('App opened from Geo Notification!', notificationData);
};