Android Bound Service and Unbound Service run in Background Android Services is used to do any background task in current activity.There is two types of Services available in android.Service class is responsible for using Services in android for that we need to extends Services class in out Custom service.
Bound Service :Service which call indefinitely in between activity
An Android component may bind itself to a Service using bindservice (). A bound service would run as long as the other application components are bound to it. As soon as they unbind, the service destroys itself.
Unbound Service :Service which call at the life span of calling activity
In this case, an application component starts the service, and it would continue to run in the background, even if the original component that initiated it is destroyed. For instance, when started, a service would continue to play music in the background indefinitely.
Services has different life cycle from Activity. Services has different method for their life cycle which is startService(),stopService(),onBindService()
No comments:
Post a Comment