Skip to content Skip to sidebar Skip to footer

How To Handle Push Firebase Notification Click Event When The Application Is In Background?

I'm New in Android. When the application is open and notification came from firebase and click the notification then it open the Notification Activity but when the application is i

Solution 1:

You should use implementation of WakefulBroadcastReceiver instead of FirebaseMessagingService

publicclassNotificationsReceiverextendsWakefulBroadcastReceiver {

        @OverridepublicvoidonReceive(Context context, Intent intent) {
            //process data from intent
            abortBroadcast();
        }
   }

In your manifest

<receiverandroid:name=".fcm.NotificationsReceiver"android:exported="true"android:permission="com.google.android.c2dm.permission.SEND"><intent-filterandroid:priority="999"><actionandroid:name="com.google.android.c2dm.intent.RECEIVE" /></intent-filter></receiver>

Post a Comment for "How To Handle Push Firebase Notification Click Event When The Application Is In Background?"