What is "android-service"
An Android service is a component for performing operations, usually long, without user interaction. Has a life cycle independent of that of the component that started it and by default (default) runs on main thread of the host process.
A service can take two forms:.
- "Started" if initiated by the method
startService()
. - "bound" when initiated by the method
bindService()
.
How a service can be started depends on which methods were
rewritten: onStartCommand()
, onBind()
or both (in this case the service may take both forms)
Regardless of how it is started, any component can use the service, even from a different application.
In the same way as a Activity, a service must also be declared in the Androidmanifesr.xml