I need to open a same activity from multiple notification trays each notification brings different data to the activity
Tried applying launchMode
as SingleTop
and SingleTask
also tried by setting different ACTIVITY_FLAGS
For example, If server returned 6 notifications to the same activity then if I click on any notification it opens activity with an information which came from very first notification to mobile than all
Piece of Code From Manifest
<activity android:launchMode="singleTop" android:name=".activity.EditAssuranceActivity" />
Piece of code from Notification Receiver Activity (Hitting EditAssuranceActivity)
if (targetActivity.equals("events")) {
intent = new Intent(this, ViewEventActivity.class);
intent.putExtra("page_title", Message);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
} else if (targetActivity.equals("assurances")) {
intent = new Intent(this, EditAssuranceActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra("page_title", Message);
}
else {
intent = new Intent(this, MainActivity.class);
}
intent.putExtra("_id", parameter_id.get("post_id"));
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);