DavidBriglio / cordova-ios10-simple-notification

Add simple local notifications to your cordova iOS 10 application.
MIT License
1 stars 1 forks source link

Payload handler not called when app is started from notifications? #6

Open hessius opened 6 years ago

hessius commented 6 years ago

As in title; When a notification is tapped to open the app I can't seem to get it to trigger the payload handler. Initially I set the payload handler on device ready but have since moved it to set as soon as the plugin becomes available (through a setInterval that listens for the plugin) but to no avail. If the app is already open the plugin works perfectly. Is this a known limitation or a bug in the implementation?

DavidBriglio commented 6 years ago

I will try to reproduce and debug this issue. Thank you for bringing it to my attention!

hessius commented 6 years ago

No, thank you

Tested on iOS 11.4, iPhone 7 plus. I removed my logic from the handler and just added an alert to show if the payload was received and added it to an interval:

let cdvInterval = setInterval(()=>{

  if (typeof cordova.plugins.ios10 === 'undefined') return

  clearInterval(cdvInterval);

  cordova.plugins.ios10.simpleNotification.setHandler(
    (action, payload) => alert(payload)
  )
}, 10)

But that didn't produce any different results from just adding it to the device ready

hessius commented 6 years ago

(I know these are totally different and might handle the payload differently but I'm using https://github.com/EddyVerbruggen/cordova-plugin-3dtouch succesfully which also needs to handle a payload at launch before deviceready is fired and the handler has been set)