Hey Kostya, you were right. I dont need to hold the intents in java, I can cancel it this way:
mAlarmManager.cancel(PendingIntent.getBroadcast(this, intentId, myBroadcastIntent, 0)); Thanks a lot for this!!! ;-) -Danny S. On 20 Jan., 10:33, Kostya Vasilyev <[email protected]> wrote: > Danny, > > Android already keeps a global registry of pending intents, so keeping a > parallel hash map should not be necessary. > > To cancel an alarm, you don't need a reference to the original Java > object, you can just construct a pending intent the same way as you did > when setting the alarm (including the request code). > > The hash table can go away with the process, while alarms persist (with > them being inside Android). If you're relying on the map being an > up-to-date representation of your alarms, make sure that it's correctly > reconstructed from scratch - or get rid of it altogether. > > -- Kostya > > 20.01.2011 11:55,DannyS. пишет: > > > > > > > > > > > Good Morning! > > > Wow, you helped me to get it work. I create a PendingIntent with a > > unique id and store the intent mapped to their IDs in a HashMap. I > > collect all intents with the known id and can the cancel them using > > the AlarmManager. I dont know if it is recommended and efficient to > > store those intents in a HashMap, but I need the PendingIntent when > > I'll cancel the alarm and it worked. > > > Maybe I have to optimize something, but now I understood how to work > > with the AlarmManager AND multiple scheduling tasks. > > > Thans a lot! > > -DannyS. > > > On 19 Jan., 17:26, Kostya Vasilyev<[email protected]> wrote: > >>Danny, > > >> The issue with multiple alarms comes up quite often, this is one of > >> several responses: > > >>http://groups.google.com/group/android-developers/browse_thread/threa... > > >> -- Kostya > > >> 19.01.2011 19:09,DannyS. пишет: > > >>> Hi, > >>> the AlarmManager is exactly what I need. It works fine, but I don't > >>> figured out yet how to set more than 1 alarm on a AlarmManager. > >>> I am using a BroadcastReceiver to receive that is called if the > >>> scheduling time is reached. First I forgot to add the receiver- Tag in > >>> the AndroidManifest.xml and wondered why the alarm is not fired ^^ But > >>> now it works, but only for the last data I set on the manager. > >>> Hope you can help, meanwhile I go home and do some searches on > >>> Google :D > >>> ´Thanks! > >>> -DannyS. > >>> On Jan 19, 10:49 am, "DannyS."<[email protected]> wrote: > >>>> Hello Kostya, > >>>> WOW, thank you very much, I'll have a look and reply with results and > >>>> questions if I have ;-) > >>>> -DannyS. > >>>> On Jan 19, 9:09 am, Kostya Vasilyev<[email protected]> wrote: > >>>>> 19.01.2011 10:07,DannyS. пишет: > >>>>>> Hi, > >>>>>> I have a service that is running in background. It needs to send > >>>>>> notifications to the user. In my application you can create data with > >>>>>> date and time. The service now can fetch this data and give the user a > >>>>>> notification t-x minutes before the saved time is reached ("remind for > >>>>>> appointments"). > >>>>>> Can I set a fix moment when the service should send the user a > >>>>>> notification instead of listen/check all the time for (approximately) > >>>>>> time identity? > >>>>> See AlarmManager > >>>>>> And a secondary question: how can I set "Autostart" for the > >>>>>> applications service? > >>>>> See Intent.ACTION_BOOT_COMPLETED > >>>>> -- Kostya > >>>>>> Thanks a lot! > >>>>>> -DannyS. > >>>>> -- > >>>>> Kostya Vasilyev -- WiFi Manager + pretty widget > >>>>> --http://kmansoft.wordpress.com > >> -- > >> Kostya Vasilyev -- WiFi Manager + pretty widget > >> --http://kmansoft.wordpress.com > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget > --http://kmansoft.wordpress.com -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

