To get around this problem look at the flags the PendingIntent takes,
I changed mine to PedingIntent.FLAG_CANCEL_CURRENT in the getBroadcast
method, it means that if there was a previous PendingIntent it will
update it with the new Intent.

What I am not sure about yet is being able to create/control more than
one of the same PendingIntent's that do the same thing. For multiple
reminders for instance like what I am trying.

Hope this helps

On Jul 1, 7:52 am, varsha acharya <[email protected]> wrote:
> Hi,
> I have a similar problem..
> I have to send a sms on alarm to a predefined number. first time it works
> well... sends the sms on alarm but then if i set the alarm to send a
> different sms,it sends the previous sms.
>
>
>
> ---------- Forwarded message ----------
> From: Veroland <[email protected]>
> Date: Tue, Jun 30, 2009 at 3:53 PM
> Subject: [android-beginners] Alarm Manager
> To: Android Beginners <[email protected]>
>
> Hi
>
> I have 2 problems,
>
> I create a timer using AlarmManager and I set an Intent with certain
> values in the putExtra methods and then create the pendingIntent with
> this intent and call alamarmManager.set(RTC_Wakeup, time,
> pendingIntent)
>
> 1.  The first time I do this everything works fine. The second time I
> do this and use a intent with different data in the intent when the
> alarm gets fired in my BroadcastReceiver class the data on the intent
> is the data of the intent used in the first alarm and NOT the second
> one.
>
> 2. If I call the alarmManager.set 2 times with 2 differents intents
> and settings only the last alarmManager.set seems to result in my
> broadcast receiver getting called. Does anyone know how to create
> multiple alarms?
>
> Here is my code I use to create the alarms
>
> Intent i = new Intent(getApplicationContext(), ReminderAlarm.class);
> i.putExtra(ReminderDbAdapter.KEY_ROWID, extras.getLong
> (ReminderDbAdapter.KEY_ROWID));
> i.putExtra(ReminderDbAdapter.KEY_TITLE, extras.getString
> (ReminderDbAdapter.KEY_TITLE));
> i.putExtra(ReminderDbAdapter.KEY_BODY, extras.getString
> (ReminderDbAdapter.KEY_BODY));
> Log.d("Sending", extras.getString(ReminderDbAdapter.KEY_TITLE));
> PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, i,
> 0);
>
> AlarmManager alarmManager = (AlarmManager) getSystemService
> (ALARM_SERVICE);
> alarmManager.set(AlarmManager.RTC_WAKEUP, lcal, pendingIntent);
>
> --
> Regards,
> Varsha
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to