On Dec 21, 8:19 am, Kalyan Akella <[email protected]> wrote:
> Hi,
>
> I just tested the start & bind service approach and found some really weird
> stuff going on in the logcat output. Here's what I tried:
>
> Step1: the main activity A is launched.
> Step2: A's *onCreate* method attempts to connect with service S (launched in
> a separate process private to the activity) in the following way:
>
>    1. Reads the SharedPreferences to determine if S is already started
>    (using a boolean flag)
>    2. If S is not started, invokes *startService* with intent I (*new
>    Intent(this, MyService.class)*)
>       - Also sets the flag in SharedPreferences to indicate service started

This is pointless to use SharedPreferences this way..  You can call
startService multiple times. There is only one Service instance ever
started.

Also you mentioned at the beginning that this is an IntentService.
The behavior of an IntentService is that it stops itself when there
are not more Itents waiting to be processed.  So the Serivice is not
being killed.  It is exiting as designed.

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