I have integrated Fire base cloud messaging with my application. When I was sending notification from firebase console, If app is in background/not opened then I am receiving notification,
but unable to receive notification when app is in foreground/open
all suggestions are appreciated.
FirebaseMessagingService
never work when the app is in foreground. In this case if you want to receive the message from FCM thenWakefulBroadcastReceiver
will work for youLink
firebase
withGCM
in play store and write the below code in manifestWhen app is in foreground,notifications are not generated themselves.you need to write some additional code.when message is received onMessagereceived method is called where you can generate the notification.here is the code: