Android - Firebase Notification Not Opening Targeted Activity When App Is In Background But Working Properly In Foreground
Solution 1:
You need to set click action in your json payload in notification request 'click_action' => 'YourTAG' and apply same tag in your manifest activity
<activityandroid:name=".activity.NotificationViewer"><intent-filter><actionandroid:name="YourTAG" /><categoryandroid:name="android.intent.category.DEFAULT"/></intent-filter></activity>
Solution 2:
You are most likely using the Firebase Notification message instead of the Data message.
If this is the case, using Data FCM message should do the trick for you.
As can be seen in https://firebase.google.com/docs/cloud-messaging/concept-options
Use notification messages when you want FCM to handle displaying a notification on your client app's behalf. Use data messages when you want to process the messages on your client app.
Notification Messages:
When your application is in the foreground, it receives the payload, but when in the background, Notification messages are delivered to the notification tray.
Data Messages: These are are always delivered to the application, regardless if it is in the foreground or in the background.
NOTE: The FCM data message alone will not bring your application in the foreground. You will need additional code that will do that upon reception of the data message.
Post a Comment for "Android - Firebase Notification Not Opening Targeted Activity When App Is In Background But Working Properly In Foreground"