How did u achieve that, can u be a bit more elaborative. I am facing
the same problem i tried using different requestcode but it didnt
work.
Thanks

On Jul 2, 4:54 pm, Veroland <marius.ven...@gmail.com> wrote:
> Thanks, I saw in the documentation that it was not used but tried to
> set the request code to my alarm's corresponding db entity's id and it
> looks like its working. I only tried that this morning for the first
> time.
>
> Thanks for the help
>
> On Jul 2, 8:42 am, Beth <emez...@gmail.com> wrote:
>
>
>
> > I hit this issue hard and found the answers sorting through threads on
> > the non-beginner developer group.  Here is what I learned...
>
> > When setting more than one timer/alarm, the second parameter in the
> > Pending Intent call to getBroadcast is important.
> > Your code looks like this:
> > PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, i,
> > 0);
>
> > The first zero can be changed up.  At this point, the docs define the
> > second parameter this way:
> > requestCode     Private request code for the sender (currently not used).
>
> > However, this request code can be used.  If you want to setup a bunch
> > of timers/alarm calls, try using unique request codes for each
> > individual alarm.  Track these request codes and set them to be the
> > same when you want to update or cancel an existing alarm.  Although
> > the docs say that system is supposed to recognize the intent parameter
> > and take action based on matching the intent and the flags in the last
> > parameter, I found that the request code was used in the match-up.
> > Setting unique request codes for each unique intent solved all my
> > problems.  World peace will ensue.
>
> > Best regards,
> > Beth
>
> > On Jul 1, 11:09 am, Veroland <marius.ven...@gmail.com> wrote:
>
> > > 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 <varsha.acharya...@gmail.com> 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 <marius.ven...@gmail.com>
> > > > Date: Tue, Jun 30, 2009 at 3:53 PM
> > > > Subject: [android-beginners] Alarm Manager
> > > > To: Android Beginners <android-beginners@googlegroups.com>
>
> > > > 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- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to