How to i specify the activity that opens after i click on the notification (Android)

42 views
Skip to first unread message

Abhilash Sathe

unread,
May 25, 2015, 1:21:19 AM5/25/15
to wizr...@googlegroups.com
How do i fetch json data obtained in the notification and  provide an Intent to open a specific activity?

WizRocket support

unread,
May 25, 2015, 2:28:57 AM5/25/15
to wizr...@googlegroups.com
Hello Abhilash,
After adding the key value pairs to the notification while creating it in our dashboard, you may retrieve them from the intent that is sent in onNewIntent() as its parameter (by calling intent.getExtras()), or by using getIntent().getExtras() in your onCreate() method.

To open an activity, please refer to the Android documentation here.


Let us know if you need any further clarifications.

abhila...@gmail.com

unread,
May 25, 2015, 3:32:51 AM5/25/15
to wizr...@googlegroups.com
Thanks for the reply.
Ok, this is what I've done.

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String id = getIntent().getExtras().getString("myparam");
Intent intent = new Intent(this, NewActivityToBeOpened.class);
intent.putExtra("myid", id);
startActivity(intent);
} However, when i click on the notification, the new Activity is not triggered. Basically, my debugger itself is not activated when i receive the notification. I've put my debug point in the onNewIntent method. So what can be the issue?

WizRocket support

unread,
May 25, 2015, 8:05:12 AM5/25/15
to wizr...@googlegroups.com
Which activity is this code in? Opening notifications created by WizRocket launches the app's default activity (launch activity declared in your AndroidManifest.xml).

abhila...@gmail.com

unread,
May 25, 2015, 8:08:32 AM5/25/15
to wizr...@googlegroups.com
So how and where can i override the default launch?
Message has been deleted

WizRocket support

unread,
May 25, 2015, 8:13:51 AM5/25/15
to wizr...@googlegroups.com
You will get the intent with extras only in your launch activity. Please handle the payload in your launch activity.
Message has been deleted

abhila...@gmail.com

unread,
May 25, 2015, 8:27:47 AM5/25/15
to wizr...@googlegroups.com
Ok Cool ! However, i tried this. In my launcher activity i used the below method. However i was assuming that as soon as i receive the notification, my debugger will get active (because onNewIntent would be called ). But this didn't happen. When i clicked on the notification, my main activity opened. This is not something that i want. What i want is to open an activity X when i click on the notification. is that possible?

WizRocket support

unread,
May 25, 2015, 9:22:50 AM5/25/15
to wizr...@googlegroups.com
Yes, this is possible. It is known as deep linking.

Please refer to our Android SDK documentation and to this page.
Reply all
Reply to author
Forward
0 new messages