I did something similar, however, i did not use a BroadcastReceiver to
get callbacks back from the service.
Instead i used the RemoteCallbackList class:

  http://developer.android.com/reference/android/os/RemoteCallbackList.html

No fiddling with intents and such. Just define a callback interface
and bind to it in your client and call it in your service and you're
done.

It works like a breeze :-)

On Mar 16, 6:16 am, BoD <bodl...@gmail.com> wrote:
> Replying myself, for future reference.
> For the scheduling part I used AlarmManager and a Service as mentioned
> before.
> For the "notification back" part I ended up using sendBroadcast from
> the service and a BroadcastReceiver on my Activity (registering/
> unregistering it in onResume/onPause). It works fine.
>
> BoD
>
> On Mar 15, 7:22 pm, BoD <bodl...@gmail.com> wrote:
>
>
>
> > Hi!
>
> > I'm trying to find the "correct" way to do the following:
>
> > . I have an activity with a button that starts a repeating task in the
> > background. That is, if the user goes away from my activity, I want my
> > task to still be scheduled and executed every x minutes.
>
> > . I want a status TextView to be displayed on the activity, and if the
> > task happens to start executing while my activity is showing, the
> > TextView should be updated so the user can be aware of what's going
> > on.
>
> > So basically, is there a way to start a scheduled background repeating
> > task and be notified when it is executed?
>
> > From what I saw in the sample applications, I understand I'm supposed
> > to use AlarmManager and a Service but I'm not sure about the
> > notification part.
>
> > Thanks a lot for your help.
>
> > BoD- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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