Markus, You should match up calls to bindService() and unbindService().
If you bind to the service in your Activity's onStart(), call unbindService in onStop().
Next time your activity is started, it will call bindService() again. Service lifecycle is managed by Android, and the service will be started again if it is killed or exits by that time.
-- Kostya 11.08.2010 17:19, maecky пишет:
Hi, I have implemented a RemoteService which will increment a countere ( just for testing purposes ). Therefore I have a Task class which implements Runnable and the method run() where a infinite while loop increments the variable. > From the client side, I start the RemoteService with startService and then i bind to the service. When I close the activity, the service is still running. Now i want to rebind to the service. 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)? What would happen, if I call startService() if the service is already running? Does the OS start a second service, or will it affect the service which is already running? I am a little confused an can't find the answer in the developer resources. Thanks for your help in advance, regards, Markus
-- Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com -- 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