Android's Bound Services - What You Should Know
Android's Bound Services - What You Should Know
Android'sboundServices:Whatyoushouldknow
(https://play.google.com/store/apps/details?id=idig.za.net.addiction)
Free Android app covering all aspects of addiction, including prevention and treatment
You are here: Home (/) / Tutorials (/index.php/latest.html) / Articles (/index.php/itemlist/category/8-articles.html) / Bound Services: What you should know!
Tweet
Checkoutourgoogle+page
Like
Send
Share
(https://plus.google.com/+101appsCoZa/?prsrc=3)
Share
Written by Clive
http://www.101apps.co.za/articles/boundserviceswhatyoushouldknow.html
1/4
10/21/2016
Android'sboundServices:Whatyoushouldknow
http://www.101apps.co.za/articles/boundserviceswhatyoushouldknow.html
2/4
10/21/2016
Android'sboundServices:Whatyoushouldknow
A bound Service is commonly used to interact with a Service when both client and Service are in the same process
The Clients
Clients are app components that bind to the Service.
These are the clients that can bind to a Service:
Activities
Services
Content Providers
You cant bind to a Service from:
Broadcast Receivers
The Service automatically disconnects, or unbinds from the Service when the client is destroyed (unless the Service was started with startService(), in which case it
will continue running until called to stop). Bear in mind that an activity is destroyed when the device changes orientation.
You should manually unbind from the Service when you dont need it. For example, unbind from the Service when your activity pauses so that the Service can shut
down and release its resources.
http://www.101apps.co.za/articles/boundserviceswhatyoushouldknow.html
3/4
10/21/2016
Android'sboundServices:Whatyoushouldknow
If you connected to a running Service using the BIND_AUTO_CREATE , and you call stopService, the Service will not stop until all these clients have unbound.
onDestroy() is called when the Service stops. This is where you can release any resources by stopping threads and unregistering receivers for example.
Related items
Realm databases for Android beginners (/index.php/item/186-realmdatabases-for-android-beginners.html)
Addiction 101:Help for addicts (/index.php/item/185-addiction-101-help-foraddicts.html)
Open Images Gold: Version 6 help (/index.php/item/184-open-images-goldversion-6-help.html)
Free Clip Art Gold, version 2.1 upgrade (/index.php/item/183-free-clip-artgold-version-2-1-upgrade.html)
Android Image editing app (/index.php/applications/android-image-editingapp.html)
http://www.101apps.co.za/articles/boundserviceswhatyoushouldknow.html
4/4