Phonegap / Cordova notifications from background.

I'm trying to figure out if I can capture the event in cordova for when a user clicks on a notification from outside the app. Our notifications have some extra fields that users can use to drive to specific areas of the app. I see some debugging commands when the app is backgrounded, but I have no way of capturing that inside cordova. Is there an event that I'm missing, or is this just not possible?

Jun 3 10:39:10 iPhone AppName[1478] <Warning>: [D] -[UAirshipPlugin launchedFromNotification:] [Line 673] The application was launched or resumed from a notification {

aps = {
alert = "Fed hike in June effectively off table after jobs data, futures market indicates >>";
badge = 0;
expiration = "6/3/2016 1:38:36 PM";
target = "urn:mwpublishing/bulletin/story/71f97ba4-2981-11e6-a40c-904945ea50ed?lastupdatedoa=42524.3880787037";

Didn't find what you were looking for?

New post



  • Hi Terry,

    The event listener "resume", as well as the callbacks "onLaunchedFromPush" are meant to handle situations where a user taps on a notification from outside the app. From there, you will be able to perform some action based off of the information inside the event.

    As an example, our Example html page shows what this would look like:

    Phonegap Sample

    Comment actions Permalink
  • Michael,
    I've looked through the sample and implemented the hooks in my app. I am getting the method UAirship.getLaunchNotification firing, and it's acting as I'm expecting. The issue I'm having now is that when the app is closed, and a user clicks on the notification, it works as expected, but if the app is backgrounded, that method isn't called. I can see in the logs that the app picks up the notification, but the javascript is never called. Is this the expected behavior, or is something possibly mixed up somehow?

    I'm on version 5.0.1 of the plugin, and version 6.2.0 of cordova.


    Comment actions Permalink
  • Terry,

    Hmm...that should get called regardless.

    Are you using the sample html included with the UA plugin?

    If so, if you wouldn't mind updating to the latest plugin and giving that a test, that would be helpful!

    Comment actions Permalink
  • It looks like that resolved my issue.  Not sure why my cordova remove / add didn't cause the version to update, but it seems to be working now.




    Comment actions Permalink
  • Terry,

    No problem, happy to help!

    Comment actions Permalink

Please sign in to leave a comment.