I had a similar problem with wanting to set multiple alarms. I worked around
it by spawning a new alarm after the first one completed. Not ideal, but I
think an application can only have one alarm set at a time (can someone
confirm?)

On Wed, Jul 1, 2009 at 9:43 AM, Marius Venter <[email protected]>wrote:

> OK, I got it point 1 working, I did not add my
> PedingIntent.FLAG_CANCEL_CURRENT.
> However, point 2 still a problem, how can I create a new PendingIntent
> instead of retrieving the one that is alread there?
>
> On Tue, Jun 30, 2009 at 12:23 PM, Veroland <[email protected]>wrote:
>
>> 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);
>>
>
>
> >
>


-- 
Andrew Burgess

--~--~---------~--~----~------------~-------~--~----~
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