I need to open a specific activity when the app is running in background (not killed) using Firebase notification system. As per the doc, Notification tray will open the default activity and send the intent to it.
To open a specific activity, I added an <Intent> to Manifest file:
<intent-filter>
<action android:name="OPEN_ACTIVITY_1" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Sending data through Postman as a Post request:
{
"notification" : {
"OPEN_ACTIVITY_1":".activity.TemActivity_",
"body" : "update !"
},
"data": {
"type":0,
"question":"open the activity"
},
"to": "dDmXZa9k6-o:APA91bEx91oyYnOyzK3kX839EqbvA2CgY74s-
fLUs8MCYZzVmnp-RpgyI3zicEFVS37K7A4kPpbbqYU9hMBEbs-
PrBXlSTYTOBVd7O3CNvl1vaTEbGIHjLLRTWvEK2VRCvJkhQTXWtr3"
}
However, I am getting the notificaiton and when I am clicking the notificaiton tray. It's always opening the default intent activity. What Am I doing wrong here to open the TeamActivity_ (Using android annotation)
Edit-1
public class MessagingService extends FirebaseMessagingService {
public String TAG = "Data";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
System.out.println("data");
}
}
My token is valid because I can see the notification tray.