Android Service edit

Lifecycle of a Service

The services lifecycle has the following callbacks

Executed when the service is first created in order to set up the initial configurations you might need. This method is executed only if the service is not already running.

Executed every time startService() is invoked by another component, like an Activity or a BroadcastReceiver. When you use this method, the Service will run until you call stopSelf() or stopService(). Note that regardless of how many times you call onStartCommand(), the methods stopSelf() and stopService() must be invoked only once in order to stop the service.

Executed when a component calls bindService() and returns an instance of IBInder, providing a communication channel to the Service. A call to bindService() will keep the service running as long as there are clients bound to it.

Executed when the service is no longer in use and allows for disposal of resources that have been allocated.

It is important to note that during the lifecycle of a service other callbacks might be invoked such as onConfigurationChanged() and onLowMemory()


Table Of Contents
18 Service
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close