25

When I receive a push notification on my phone when my app is minimized, if I click on the notification to launch my app, calling

window.pushNotification.getIncoming( callback )

returns {"message":"","extras":{}} rather than the data for the notification I clicked.

Is this correct behavior? If so is there a way to get the information I want?

b4hand
  • 9,550
  • 4
  • 44
  • 49
user1990478
  • 251
  • 2
  • 2
  • I've got the same issue. I'm running the function after the phonegap "resume" event. – Harm de Wit Mar 11 '13 at 16:22
  • Ditto. Same problem. I can only get data from getIncoming during initial app startup but not on resume event. Working as you would expect it to in Android. – the_new_mr May 30 '13 at 13:09
  • @the_new_mr I saw your posts about this on the UA support forum - did you ever figure this out? – jackocnr Sep 17 '13 at 21:55
  • I found that it worked on first call on Android but not on iOS. They have apparently fixed this in iOS but I haven't had access to an iOS device recently to test this. For Android, though it isn't clear from the documentation, you need to perform the statement in my questions whenever you want the data. It's not like other statements where you define a callback to be called on receipt of a notification. You perform the statement above with the callback defined and then, when the data is ready, the callback is called. Hope I've made myself clear there. – the_new_mr Sep 18 '13 at 11:40
  • As far as I can tell, it's still broken on iOS. Straight-off getIncoming yields an empty message every time even if opening the app by clicking on a notification, but running on document's "resume" event yields the messages as expected. – Ezku Feb 17 '14 at 12:53

1 Answers1

1

Use below code for PhoneGap push notification

window.LocalNotification.add({
                    message : "hello",
                    ticker : "New Notification",
                    repeatDaily : false,
                    id : 4
                }, newNotification);


function newNotification(e) {
if (e != null && e.event == "newLocalNotification") {
    // add my Appointment page
    window.location = "#redirectPageId";

}

}

Use "redirectPageId" for redirect page

NaveenG
  • 292
  • 3
  • 11