cordova-plugin-local-notifications: phonegap-plugin-push notifications no longer received after installing cordova-plugin-local-notifications

Thanks for a nice plugin! It does exactly what I need (and more), however I need to still be able to receive push notifications but after installing this plugin my callback for the ‘notification’ event from the phonegap-plugin-push plugin is no longer called. Is this expected?

Your Environment

  • Plugin version: 0.9.0-beta.2 and 0.9.0-beta.3 tested
  • Platform: iOS
  • OS version: 11.3
  • Device manufacturer / model: iPhone 6.0
  • Cordova version (cordova -v): 8.0.0
  • Cordova platform version (cordova platform ls): ios 4.5.4
  • Plugin config default values
  • Ionic Version (if using Ionic) no ionic

Expected Behavior

phonegap-plugin-push should still dispatch notification events

Actual Behavior

phonegap-plugin-push no longer dispatches notification events

Steps to Reproduce

  1. Create an app using phonegap-plugin-push and listen for ‘notification’ events.
  2. Verify that the ‘notification’ events are dispatched when push notification events are sent to the device
  3. install cordova-plugin-local-notifications
  4. Send push notifications to the device

Context

I wanted to use the cordova-plugin-local-notifications to show iOS notifications when push notifications are received when in foreground.

Debug logs

2018-06-19 16:22:01.176937+0200 TaskRunner Pro[1460:1117588] Push Plugin VoIP missing or false 2018-06-19 16:22:01.177356+0200 TaskRunner Pro[1460:1117721] Push Plugin register called 2018-06-19 16:22:01.177426+0200 TaskRunner Pro[1460:1117721] PushPlugin.register: setting badge to false 2018-06-19 16:22:01.177450+0200 TaskRunner Pro[1460:1117721] PushPlugin.register: clear badge is set to 0 2018-06-19 16:22:01.177475+0200 TaskRunner Pro[1460:1117721] PushPlugin.register: better button setup 2018-06-19 16:22:01.177817+0200 TaskRunner Pro[1460:1117721] FCM Sender ID (null) 2018-06-19 16:22:01.177855+0200 TaskRunner Pro[1460:1117721] Using APNS Notification 2018-06-19 16:22:01.226741+0200 TaskRunner Pro[1460:1117588] Push Plugin register success: <<my-device-registration-id-here>>

but then nothing is logged when I send push notifications

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 4
  • Comments: 18

Most upvoted comments

It would be great if this issue could be fixed, so we can show notifications both in back and foreground when using the library along with push notifications.

Thanks in advance!

i tested with latest version problem with ios still exist

you might try downgrading the phonegap-plugin-push to 1.8.4. I use that along with local notifications beta-3 (three!, not 2) and can receive push notifications and local notifications.

So this issue exists not in this plugin but instead in the https://github.com/phonegap/phonegap-plugin-push

The issue lies in the fact that this local notifications plugin makes use of UNUserNotifications delegate instead of the Application delegate used by the phonegap-plugin-push.

To get around this, you will need to update the latest phonegap-plugin-push release which you can see here: https://github.com/phonegap/phonegap-plugin-push/releases

This will ensure that you are able to also “catch” the notifications and the payload using the phonegap-plugin-push.

This local notifications plugin is actually written correctly as it calls the main delegate to ensure that other native layers are able to make use of the UNUserNotification delegate methods:

[_delegate userNotificationCenter:center willPresentNotification:notification withCompletionHandler:handler];

This is why, when updating to the latest phonegap plugin version for push notifications, everything should work as per usual.

I hope this helps everyone!