My push notifications contain custom data that helps route the app to the right place when the notification is clicked. These work fine if the app is open or in the background, but don't work when the app is closed. The notification opens the app but my code doesn't detect the referenced notification event so that I can route it. I have this in AppDelegate.m

#ifndef DISABLE_PUSH_NOTIFICATIONS

    - (void)                                 application:(UIApplication*)application
        didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
        // re-post ( broadcast )
        NSString* token = [[[[deviceToken description]
            stringByReplacingOccurrencesOfString:@"<" withString:@""]
            stringByReplacingOccurrencesOfString:@">" withString:@""]
            stringByReplacingOccurrencesOfString:@" " withString:@""];

        [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
    }

    - (void)                                 application:(UIApplication*)application
        didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
    {
        // re-post ( broadcast )
        [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
    }
#endif

I have this JS code in place to catch the notification in my app

document.addEventListener('push-notification', function(event) {
                             //get the notification payload

                             console.log("incoming PUSH notification!")
                             console.log(event);
                             factory.reactToIncomingPushNotification(event)


                         });

My question is how do I reference the notification event in the app once the app has cold started? I think this used to work in my app but not sure when it stopped

I have a cordova/ionic app with pushwoosh as the provider. I am testing on IOS.

asked 18 Aug '17, 19:36
javacado's gravatar image

javacado
11

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×446
×353
×326

question asked: 18 Aug '17, 19:36

question was seen: 164 times

last updated: 18 Aug '17, 19:36