1. Is it required that the service should be running to use bindService(Intent)?
No, but if it is not running, you will need the BIND_AUTO_CREATE
flag as the last parameter to bindService()
2. What is differnce between startService and bindService?
starts the service. bindService()
binds an AIDL client to an AIDL interface of the service, possibly starting it if BIND_AUTO_CREATE
is included. When you later unbind from that service, if nobody else has bound to it and nobody else called startService()
, the service will automatically shut down. When you call startService()
, the service will run until either you call stopService()
, the service calls stopSelf()
, or the OS kills off the process to reclaim memory.