question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

phonegap-plugin-push event on notification recieved not being fired

See original GitHub issue

Trying to get the phonegap-plugin-push working with Capacitor and have some problems.

For starters the project wont build if I first dont in the build.gradle-file change the firebase-messaging version to 17.1.0 instead of 11.6.2. I get the following error with 11.6.2:

The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 11.6.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Using 17.1.0 the project is built and the app launches.

let push = PushNotification.init({'android': {}})
    push.on('registration', (token) => {
      console.log('Token: ' + token)
      if (token) {
        Device.getInfo().then((result) => {
          _this.registerDeviceForPushNotifications(result.platform, token)
        })
      }
    })

    push.on('notification', (data) => {
      console.log('Notification: ' + JSON.stringify(data))
    })

The registration-event is fired after init has been called. When sending a test-notification via my Azure Notification Hub the notification-event isn’t fired. The following two lines shows in the logcat though:

V/Capacitor/Plugin/PushNotifications: Notifying listeners for event pushNotificationReceived
D/Capacitor/Plugin/PushNotifications: No listeners found for event pushNotificationReceived

I’m not using Capacitors PushNotifications-plugin in any way.

Any ideas what’s going on? Starting to hate everything regarding Push Notifications…

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jcesarmobilecommented, Nov 20, 2018

Yeah, it’s probably that, I don’t think it can work now that Capacitor has it’s own class for FirebaseMessagingService

You can try removing this

<service android:name="com.getcapacitor.CapacitorFirebaseMessagingService" android:stopWithTask="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>
1reaction
nguyen124commented, Jun 30, 2020

Yeah, it’s probably that, I don’t think it can work now that Capacitor has it’s own class for FirebaseMessagingService

You can try removing this

<service android:name="com.getcapacitor.CapacitorFirebaseMessagingService" android:stopWithTask="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

You saved my life. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

phonegap-plugin-push on("notification") event is not firing ...
This is not the issue with client side code. This issue is occuring because of the notification payload.
Read more >
Phonegap-plugin-push on("notification") event is not firing ...
I am using following plugin for push notification in Ionic2 Expected Behaviour: When app is closed, And notification received, And when user ...
Read more >
Cordova Plugin event when receive notification and App is in ...
I'm using urban airship plugin and when i have the application in foreground the event: urbanairship.push is not fired, the only event...
Read more >
kiot-cordova-plugin-fcm-with-dependecy-updated - npm
If the user does not tap the notification but opens the application, nothing happens until the notification is tapped. Push Notifications on iOS....
Read more >
Phonegap Push Plugin - Monaca Docs
The custom build debugger can not check push notifications. To check push notifications, please check with a debug build or a release build....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found