My app uses multiple push notifications. I wish to add some kind of Intent data or any boxed-up data so that when I receive a push notification in my ParsePushBroadcastReceiver, I am able to detect what type of push notification it is and then show the user the appropriate screen. For example, if the notification is telling the user that a friend is trying to add you, it takes the user to the ContractRequest page.
This is what my Receiver currently looks like:
public class ParsePushReceiver extends ParsePushBroadcastReceiver {
@Override
public void onPushOpen(final Context context, final Intent intent) {
Log.i("Push", "Notification Clicked");
Intent activityIntent = new Intent(context, GameDetailsActivity.class);
activityIntent.putExtras(intent.getExtras());
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(activityIntent);
}
}
And this is how I typically send a push notification:
ParseQuery query = ParseInstallation.getQuery();
query.whereEqualTo(ParseUserHelper.USERNAME_VAR, contact.getUsername());
ParsePush.sendMessageInBackground(String.format("...");
....
Any ideas how I can wrap data within the notification so that when I intercept it in my receiver, I'll be able to do a switch statement which shall check what type of notification it is and then show the user the correct activity.