When app is running and notification is alert if I click it ,notification is go to there (onMessageReceived
is running)
but when app is in background and notification is alert if I click it, App is reload again (at first such as splash screen) ,not go to there and onMessageReceived
is not running
How to fix it?
ps. sorry my english is not good.
Give activity name to pending intent ....
See below code. I am using that and it is opening my HomeActivity.
change HomeActivity.class which activity you want to open after clicking notification.. hope it will work...
You need to pass the required activity as intent, not the MainActivity
You can check app is in the background or not and then in MyFirebaseMessagingService class you can use this method in for handle message and handle the notification.
I hope it helps you.