Jon,
  ok, I see a big plus for this approach. For a simple trigger interaction I
don't have to define a service interface with a fake trigger method.

  I am still a bit unhappy about passing in the wake lock using a static
variable, but well, I'll still go for this approach then.

  Thank you, Dianne and Marco for your help.
Cheers,
Mariano

On Mon, Mar 2, 2009 at 5:41 PM, Jon Colverson <jjc1...@gmail.com> wrote:

>
> On Mar 2, 9:42 am, Mariano Kamp <mariano.k...@gmail.com> wrote:
> > So how does that work?
>
> Here's how nanoTweeter works (slightly abbreviated):
>
> The alarm BroadcastReceiver's onReceive() acquires a WakeLock and
> stores it in a static field so that the Service can access it later.
> It then starts a Service using Context.startService().
>
> The Service's onStart() creates a Handler for the main thread and then
> creates and runs a new Thread. That Thread does the important work
> then releases the WakeLock and calls Service.stopSelf() on the main
> thread via the Handler that was set up earlier.
>
>
> I pretty much copied the model that the built-in Alarm app uses:
>
> http://android.git.kernel.org/?p=platform/packages/apps/AlarmClock.git;a=tree;h=refs/heads/release-1.0;hb=release-1.0
>
> --
> Jon
>
> >
>

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

Reply via email to