Hello,

I have a remote service started with startService() from a
BroadcastReceiver that catches BOOTUP_COMPLETED, at phone power up. I
also have a service controller with startService() and stopService()
that works perfectly when no client is bound to the service.

When I bind to my service from clients, stopService doesn't work until
the last client has executed unbindService. And if one of my clients
gets destroyed (just by pushing the Back button on the right side of
the phone) then I can't stop the service at all (it didn't execute
unbindService).

One of the solutions is to execute unbindService in my client at the
onPause event. What is an alternative? Say if I wouldn't have control/
access to the client application and I don't know if the client
executes unbindService at onPause(),  and I still wanted a way to stop
the service at my discretion..what should I do ?

One more thing..for the client's connection to the service I provide
an object (let's say GenericConnection object) that manages the
connection (it provides functions like connectService() and
disconnectService() after being created). That's the only control I
have in the client's code: it instantiates my object and uses its
functions. How can I model my object so that the client would execute
unbindService when its Activity is being stopped? I also thought about
forcing the client, instead of instantiating my object, to extend my
class instead of Activity, and in my class I would override onPause
and call unbindService myself.

 Any other ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to