Reputation: 25
I am newbie please help me and clarify that if Activity finish then Service also finish or not? for example if activity start Services and then call to second Activity and finish itself then service also finish or remain? My secinds Question is Start services on splash Activity is good or not?
Upvotes: 0
Views: 404
Reputation: 29436
Service finish depends on how Service is started and what does it do.
If a Service is a bound service, that is started via bindService()
, then after all users of the service have called unbindService()
, then the service is stopped.
Also, inside the service the value returned from onStartCommand()
can determine if service would be restored by system if terminated or not.
Finally, a service an explicitly call stopSelf()
to shutdown itself.
Read more in documentation here: https://developer.android.com/reference/android/app/Service.html#ServiceLifecycle
Upvotes: 1
Reputation: 7162
Services run independently of the place where you start them. So
android.content.Context
.Upvotes: 0