Here is my code which I tried, Steps.
1) creating an AlarmManager event by calling AM.Set( ) method suppose with time X.
2) creating another AlarmManager event suppose with time Y.
Result = first event is triggered at time Y in place of time X. and second is not triggered at all.
AlarmManager AM =(AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent();
intent.setAction(Constants.ALARM_ACTION);
intent.putExtra(Constants.EXTRA_DATA1, data[0]);
intent.putExtra(Constants.EXTRA_DATA2, data[1]);
long selectedTime = Long.parseLong(data[2]);
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent,0);
AM.set(AlarmManager.RTC,selectedTime, pi);
Am I doing something wrong? I need to trigger all the events .
Your first and second
Intentsare equivalent, and so you wind up with the samePendingIntentobject as a result of yourgetBroadcast()call. Either:Use a unique
requestCode(2nd parameter togetBroadcast()), which I think will clear this up, orDo something to have a unique action, data (
Uri), categories, or MIME type on eachIntent(extras being different are not sufficient)