On Mon, Feb 7, 2011 at 8:35 PM, Avtar Khalsa <[email protected]> wrote:

>  However, the local service example and the class you specifically referred
> to only seem to accommodate messages from the service onServiceConnected
> and onServiceDisconnected.
>

Those are the explicit events the ServiceConnection get. Notice in the
example when the service is started, the connection object grabs a reference
to the Service. The ServiceConnection itself is referenced in the Activity.
Therefore you can get at the Service reference from your Activity through
the ServiceConnection.


> This does not really help me since my activity will be launching the
> service and then will need the service to notify it once the information
> from my server has been successfully downloaded.
>

Services are usually for maintaining an ongoing background task. Binding to
them is usually for showing the state of that background task to the user
(and possibly give them control over it). Think "music player".

If you're just trying to download some data while your Activity is alive, an
AsyncTask within your Activity may be much, much simpler.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
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

Reply via email to