Android Guides | Samples

Android.Content.Bind Enumeration

Enumerates values returned by several methods of Bind and taken as a parameter of the Context.BindService, ContextWrapper.BindService, and MockContext.BindService members.

Syntax

public enum Bind

Remarks

Members

Member NameDescription
AboveClientFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): indicates that the client application binding to this service considers the service to be more important than the app itself. When set, the platform will try to have the out of memory killer kill the app before it kills the service it is bound to, though this is not guaranteed to be the case.
AdjustWithActivityFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user, regardless whether another flag is used to reduce the amount that the client process's overall importance is used to impact it.
AllowOomManagementFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): allow the process hosting the bound service to go through its normal memory management. It will be treated more like a running service, allowing the system to (temporarily) expunge the process if low on memory or for some other whim it may have, and being more aggressive about making it a candidate to be killed (and restarted) if running for a long time.
AutoCreate

Context.BindService(Intent,IServiceConnection,IServiceConnection)Service.OnStartCommand(Intent,StartCommandFlags,StartCommandFlags)Context.StartService(Intent)

Note that prior to VERSION_CODES.IceCreamSandwich, not supplying this flag would also impact how important the system consider's the target service's process to be. When set, the only way for it to be raised was by binding from a service in which case it will only be important when that activity is in the foreground. Now to achieve this behavior you must explicitly supply the new flag Bind.AdjustWithActivity. For compatibility, old applications that don't specify Bind.AutoCreate will automatically have the flags Bind.WaivePriority and Bind.AdjustWithActivity set for them in order to achieve the same result.

DebugUnbindFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): include debugging help for mismatched calls to unbind. When this flag is set, the callstack of the following Context.UnbindService(IServiceConnection) call is retained, to be printed if a later incorrect unbind call is made. Note that doing this requires retaining information about the binding that was made for the lifetime of the app, resulting in a leak -- this should only be used for debugging.
ImportantFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): this service is very important to the client, so should be brought to the foreground process level when the client is. Normally a process can only be raised to the visibility level by a client, even if that client is in the foreground.
None
NotForegroundFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): don't allow this binding to raise the target service's process to the foreground scheduling priority. It will still be raised to at least the same memory priority as the client (so that its process will not be killable in any situation where the client is not killable), but for CPU scheduling purposes it may be left in the background. This only has an impact in the situation where the binding client is a foreground process and the target service is in a background process.
WaivePriorityFlag for Context.BindService(Intent,IServiceConnection,IServiceConnection): don't impact the scheduling or memory management priority of the target service's hosting process. Allows the service's process to be managed on the background LRU list just like a regular application process in the background.

Requirements

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

The members of Android.Content.Bind are listed below.

See Also: Enum

Public Fields

AboveClientBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): indicates that the client application binding to this service considers the service to be more important than the app itself. When set, the platform will try to have the out of memory killer kill the app before it kills the service it is bound to, though this is not guaranteed to be the case.
AdjustWithActivityBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user, regardless whether another flag is used to reduce the amount that the client process's overall importance is used to impact it.
AllowOomManagementBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): allow the process hosting the bound service to go through its normal memory management. It will be treated more like a running service, allowing the system to (temporarily) expunge the process if low on memory or for some other whim it may have, and being more aggressive about making it a candidate to be killed (and restarted) if running for a long time.
AutoCreateBind.

Context.BindService(Intent,IServiceConnection,IServiceConnection)Service.OnStartCommand(Intent,StartCommandFlags,StartCommandFlags)Context.StartService(Intent)

Note that prior to VERSION_CODES.IceCreamSandwich, not supplying this flag would also impact how important the system consider's the target service's process to be. When set, the only way for it to be raised was by binding from a service in which case it will only be important when that activity is in the foreground. Now to achieve this behavior you must explicitly supply the new flag Bind.AdjustWithActivity. For compatibility, old applications that don't specify Bind.AutoCreate will automatically have the flags Bind.WaivePriority and Bind.AdjustWithActivity set for them in order to achieve the same result.

DebugUnbindBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): include debugging help for mismatched calls to unbind. When this flag is set, the callstack of the following Context.UnbindService(IServiceConnection) call is retained, to be printed if a later incorrect unbind call is made. Note that doing this requires retaining information about the binding that was made for the lifetime of the app, resulting in a leak -- this should only be used for debugging.
ImportantBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): this service is very important to the client, so should be brought to the foreground process level when the client is. Normally a process can only be raised to the visibility level by a client, even if that client is in the foreground.
NoneBind.
NotForegroundBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): don't allow this binding to raise the target service's process to the foreground scheduling priority. It will still be raised to at least the same memory priority as the client (so that its process will not be killable in any situation where the client is not killable), but for CPU scheduling purposes it may be left in the background. This only has an impact in the situation where the binding client is a foreground process and the target service is in a background process.
WaivePriorityBind. Flag for Context.BindService(Intent,IServiceConnection,IServiceConnection): don't impact the scheduling or memory management priority of the target service's hosting process. Allows the service's process to be managed on the background LRU list just like a regular application process in the background.