Open a specified Activity from the launcher screen if the push notification is tapped

30 Views Asked by At

I need to redirect to a Specific activity in kotlin from the SplashScreen which is the launcher Activity of my application when I tap the push notification from the system tray.

In my application there is a status notification, the notifications are pushed from the firebase along with title and body. When the notification is clicked in the app background, the launcher activity is opened first and based on the user Id validation the Home Activity is opened by default, There is one more push notification with the message Type of "schedule" in the data payload, so when this notification with message Type "schedule" is clicked in the app background, instead of the Home Activity it should redirect to the Schedule Notification Activity.

I tried adding the click action parameter to the notification payload but that parameter is accepted in the notification payload.

1

There are 1 best solutions below

0
Harshil Thakkar On

You need to use putExtra(ID_KEY,id) when you create your Intent for starting your application, and in your onCreate() method you can use getIntent().getExtras().getInt(ID_KEY); to retrieve your passed id integer