Android.App.StartCommandResult Enumeration
Enumerates values returned by several types.

Syntax

[System.Flags]
public enum StartCommandResult

Remarks

Enumerates value returned by the following: .

Members

Member NameDescription
ContinuationMaskBits returned by Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) describing how to continue the service if it is killed. May be StartCommandResult.Sticky, StartCommandResult.NotSticky, StartCommandResult.RedeliverIntent, or StartCommandResult.StickyCompatibility.
NotSticky

Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) Android.Content.Context.StartService(Android.Content.Intent) Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags)

This mode makes sense for things that want to do some work as a result of being started, but can be stopped when under memory pressure and will explicit start themselves again later to do more work. An example of such a service would be one that polls for data from a server: it could schedule an alarm to poll every N minutes by having the alarm start its service. When its Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) is called from the alarm, it schedules a new alarm for N minutes later, and spawns a thread to do its networking. If its process is killed while doing that check, the service will not be restarted until the alarm goes off.

RedeliverIntentConstant to return from Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags): if this service's process is killed while it is started (after returning from Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags)), then it will be scheduled for a restart and the last delivered Intent re-delivered to it again via Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags). This Intent will remain scheduled for redelivery until the service calls Service.StopSelf(int) with the start ID provided to Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags). The service will not receive a Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) call with a null Intent because it will will only be re-started if it is not finished processing all Intents sent to it (and any such pending events will be delivered at the point of restart).
Sticky

Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags)

This mode makes sense for things that will be explicitly started and stopped to run for arbitrary periods of time, such as a service performing background music playback.

StickyCompatibilityConstant to return from Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags): compatibility version of StartCommandResult.Sticky that does not guarantee that Service.OnStartCommand(Android.Content.Intent, Android.App.StartCommandFlags, Android.App.StartCommandFlags) will be called again after being killed.

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0