Thanks for your quick answer.
If I understand right, I could solve it like this:
@Override
public void onStart( Intent intent, int startId ){
super.onStart( intent, startId );
if( !mServiceRunning ) {
mServiceHandler = new Handler();
mServiceHandler.post( mTask );
mServiceRunning = true;
}
}
Now I can call startService from the client side, before I will bind or
rebind to the service.
Is this the recommended way, to deal with remote services?
Thanks for your help!
Regards, Markus
On Wed, Aug 11, 2010 at 3:35 PM, Mark Murphy <[email protected]>wrote:
> On Wed, Aug 11, 2010 at 9:19 AM, maecky <[email protected]>
> wrote:
> > How do I know if the service has already been started (therefore i
> > would only need to bind to the service again) or not (then I would
> > need to call startService() first and then bind to the service)?
>
> You don't know.
>
> > What would happen, if I call startService() if the service is already
> > running?
>
> Nothing much. The service will be called with onStart(), so if you are
> overriding that, you will get control there.
>
> > Does the OS start a second service, or will it affect the
> > service which is already running?
>
> At most one instance of a service will be running at one time.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 2.2 Programming Books: http://commonsware.com/books
>
> --
> 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]<android-developers%[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 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