Push Notification with Firebase not working

2»

Answers

  • SteveW6219SteveW6219 USMember

    @meghatiwari its probably worth mentioning that Android has changed how notifications are handled on Oreo (API 26) and above.

    I don't know what version you're targeting but you have to create a notification channel for the handling of the notification, this dictates how and where the notification appears, e.g. audible alert, custom sound, on the lock screen, banner etc.

    Its also worth noting that if your message payload only contains a notification element then OnMessageReceived is only called when the app is in the foreground, when the app is in the background the system takes over. If however your message payload contains a data element or both a notification and data element then OnMessageReceived will be called.

    Check the Firebase documentation:
    firebase.google.com/docs/cloud-messaging/android/receive

Sign In or Register to comment.