user1897355
user1897355

Reputation: 59

android- receive the push notification text and display it in activity

I am able to send push notification from "Parse" (3rd party). But, when user receives that message, I want to receive that message in some string and display it in some Activity. I used the following default code of "Parse" to go to some activity after clicking on notification

PushService.setDefaultPushCallback(this, PushNoti.class);//change the class where u want to go after clicking on noti
ParseInstallation.getCurrentInstallation().saveInBackground();

By using it I am able go to that activity too, but can anyone help me in getting that text in some string and display it? Or, is there any default method which gets called after clicking on notification? (as in iOS)

Please do not consider this post as duplicate of Android - Receive Push notification and display it - not quite understanding as I am not using titanium.

Upvotes: 4

Views: 3432

Answers (1)

tonymayoral
tonymayoral

Reputation: 5217

The way to reach all the json data of the notification inside the started Activity is:

Intent intent = getIntent(); 
Bundle extras = intent.getExtras(); 
String jsonData = extras.getString( "com.parse.Data" );
Log.d("MyApp",jsonData);

Upvotes: 4

Related Questions