The problem  with bind/unbind - is that when the activity finishes the 
service gets stopped.

I want the service to be around - even if the mainactivity is killed.

in the Activity.onCreate() i do

        Intent requestIntent = new Intent(this, MainService.class);
        
        startService(requestIntent);

The problem is that with the above - even if the service is active - it's 
onStartCommand()
gets called again.

Should I just check a variable (i.e. onStartCommand() being call not the 
first) - i just return.

I want the method to be executed just once per service life.








On Thursday, January 30, 2014 7:43:11 PM UTC-5, TreKing wrote:
>
>
> On Thu, Jan 30, 2014 at 5:14 PM, dashman <[email protected] 
> <javascript:>>wrote:
>
>> I've got a service class that runs in the background.
>>
>> I'd like to make calls from my main activity to the service object.
>>
>> In the Activity.onCreate() method - if the service is not running - i'd 
>> like to start it.
>>
>
> I think you're looking for 
> bindService<http://developer.android.com/reference/android/content/Context.html#bindService(android.content.Intent,+android.content.ServiceConnection,+int)>
> .
>  
>
> -------------------------------------------------------------------------------------------------
> 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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to