- service
- Identifies the service to be started. The Intent must be either fully explicit (supplying a component name) or specify a specific package name it is targetted to. Additional values may be included in the Intent extras to supply arguments along with this specific start call.
Documentation for this section has not yet been entered.
Request that a given application service be started. The Intent should contain either contain the complete class name of a specific service implementation to start or a specific package name to target. If the Intent is less specified, it log a warning about this and which of the multiple matching services it finds and uses will be undefined. If this service is not already running, it will be instantiated and started (creating a process for it if needed); if it is running then it remains running.
Every call to this method will result in a corresponding call to the target service's Android.App.Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) method, with the intent given here. This provides a convenient way to submit jobs to a service without having to bind and call on to its interface.
Using startService() overrides the default service lifetime that is managed by Android.Content.Context.BindService(Android.Content.Intent, Android.Content.IServiceConnection, Android.Content.IServiceConnection): it requires the service to remain running until Android.Content.Context.StopService(Android.Content.Intent) is called, regardless of whether any clients are connected to it. Note that calls to startService() are not nesting: no matter how many times you call startService(), a single call to Android.Content.Context.StopService(Android.Content.Intent) will stop it.
The system attempts to keep running services around as much as possible. The only time they should be stopped is if the current foreground application is using so many resources that the service needs to be killed. If any errors happen in the service's process, it will automatically be restarted.
This function will throw Java.Lang.SecurityException if you do not have permission to start the given service.