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.

can I emulate FCM.getBadgeNumber in Android? Or get an event when the notification is received?

See original GitHub issue

Hi have a question for you @evollu I’m almost done with a react native app, using your plugin react-native-fcm and I really need a way to hook me when the user receive a push notification.

So if this is method is not available in Android:

FCM.setBadgeNumber(1);
FCM.getBadgeNumber().then(number => number)

can I hook my code somewhere over here?

this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
// here ?
});
react-native-fcm: 6.1.0
react-native: 0.41.2

I’m running the app in Ganymotion with android 6.0.0 and a real device: Sony X performance with Android 7.1.0

The message is actually delivered. From FireBase and locally.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
evollucommented, Oct 23, 2017

no you can’t. when iOS app is killed by user you can’t launch background processing. You will need to send badge count though notification

1reaction
evollucommented, Aug 2, 2017

yeah this is what I suggested at the first place

Read more comments on GitHub >

github_iconTop Results From Across the Web

Receive messages in an Android app - Firebase - Google
If you want foregrounded apps to receive notification messages or data messages, you'll need to write code to handle the onMessageReceived callback.
Read more >
How to track received notification in iOS and Android using ...
I wanted to track the event, how many notification were received on iOS and Android. Is there any way to get this number...
Read more >
react-native-fcm - npm
React Native bridge for firebase cloud messaging (FCM). ... NOTE: local notification does NOT have any dependency on FCM library but you ...
Read more >
Firebase Push notifications in React Native Apps - Enappd
We'll send notification using Firebase console and receive them in the app. ... can get reallllly long, I'll limit the discussion to Android...
Read more >
Handling notifications in the mobile app - 4Js
The same code base can be used to handle push notifications for Android™ (using FCM) and iOS (using APNs) devices. Only the content...
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