I am facing some problem with pending intents. I have set some Pending Intents using Notification Manager. These notification launch an activity when user click on them. I put some extras with Intent used in pending intent. This works OK with notification click.
Notification notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
Intent intentOptionDialog = new Intent(Safety_Check_Service.this, Dialog_Safety_Check.class);
intentOptionDialog.putExtra("startID",startId);
intentOptionDialog.putExtra("CheckInID", CheckInId);
intentOptionDialog.putExtra("Frequency", Frequency);
intentOptionDialog.putExtra("flagFirstShedule", true);
stopID = (startId + 17);
intentOptionDialog.putExtra("stopID", stopID);
PendingIntent contentIntent = PendingIntent.getActivity(Safety_Check_Service.this, DIALOG_ID, intentOptionDialog, 0);
But my problem is that I want to launch these pending intents from another activity. The pending intents are created. How can I lauch these pending intents from another activity and how can I get Extras that was set with the pending intent?
Please help me.
Best Answer
I think you have 2 pieces here:
FILL_IN_SELECTOR
flag when you create thePendingActivity
to force it to carry the extras with it.PendingIntent
, you can just call thesend
method to fire it.