Android: Is it better to start and stop a service each time it is needed or to let a service run and

Posted by Flo on Stack Overflow See other posts from Stack Overflow or by Flo
Published on 2010-03-30T12:41:07Z Indexed on 2010/03/30 12:43 UTC
Read the original article Hit count: 347

Filed under:
|
|

I'm developing an app that checks several conditions during an incoming phone call. The main parts of the app are a BroadcastReceiver listening for Intents related to the phone's status and a local Service checking the conditions.

At the moment the service is started each time an incoming call is detected and is stopped when the phone status changed back to idle.

Now I'm wondering if this procedure is correct and whether it is reasonable to start and stop the service related to the phone's status. Or would it be better to let the service run regardless of the phone's status and bind/unbind to/from it when needed.

Are there any performance issues I would have to think about? Perhaps it is more expensive to start/stop a service than letting it run and communicate with it. Are there any best practices out there regarding the implementation of services?

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk