Pending services work fine. However currently for the alarm manager I would recommend always first sending to a receiver, since there is a limitation in the system where the wakelock it holds will be released too early when delivering to a service. So if you want to be sure you receive the alarm, you need to deliver it to a receiver, have that receiver acquire a wake lock and start the service, and then have the service release the wake lock when appropriate.
On Wed, Jul 1, 2009 at 4:27 AM, Peli <[email protected]> wrote: > > I have not tried a pending service yet, but a quick workaround would > be to send a pending broadcast intent to yourself (broadcast > receiver), and launch the service from there. > > Regardless of this workaround, it would be nice to know whether there > are issues with pending service intents, or whether it should work. > > Peli > www.openintents.org > > On Jul 1, 12:16 pm, Richard Schilling <[email protected]> > wrote: > > I'm having a hard time finding a good working example of > > PendingIntent.getService. > > > > My code isn't working. I have a service, MyService, that I want to > > start using an alarm. Here's some code I have in my activity's onStart > > () method: > > > > AlarmManager am = (AlarmManager)this.getSystemService > > (Context.ALARM_SERVICE); > > > > Intent serviceIntent = new Intent(getApplicationContext(), > > Nomad.class); > > serviceIntent.putExtra("type", "functiona"); > > > > PendingIntent alarmIntent = PendingIntent.getService(this, 0, > > serviceIntent, PendingIntent.FLAG_CANCEL_CURRENT); > > > > am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + > > 10000, 10000, alarmIntent); > > > > I also have my service declared in my manifest. The service has no > > intent filters associated with it. > > > > My understanding is that PendingIntent.getService will cause my > > service to be started. > > > > But, it's not. > > > > Help, anyone, please ..... > > > > Thanks. > > > > Richard > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

