i have set some alarm like:
public void SetAlarm(Context context, int tag, long time){
AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, Alarm.class);
i.putExtra("position", tag);
PendingIntent pi = PendingIntent.getBroadcast(context, tag, i, PendingIntent.FLAG_CANCEL_CURRENT);
am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()+ time, pi); // Millisec * Second * Minute
}
now for some reason i want to update the Intent i
of a triggered alarm. i have the id(tag) for identify the desire alarm. how can i do that ?
If all you want to do is change the extras in the
Intent
, you can do it like this:Otherwise, if you want to change anything else in the
Intent
(like the action, or component, or data), you should cancel the current alarm and create a new one like this: