Notification.Builder.SetForegroundServiceBehavior(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specify a desired visibility policy for a Notification associated with a foreground service.
[Android.Runtime.Register("setForegroundServiceBehavior", "(I)Landroid/app/Notification$Builder;", "GetSetForegroundServiceBehavior_IHandler", ApiSince=31)]
public virtual Android.App.Notification.Builder SetForegroundServiceBehavior(int behavior);
[<Android.Runtime.Register("setForegroundServiceBehavior", "(I)Landroid/app/Notification$Builder;", "GetSetForegroundServiceBehavior_IHandler", ApiSince=31)>]
abstract member SetForegroundServiceBehavior : int -> Android.App.Notification.Builder
override this.SetForegroundServiceBehavior : int -> Android.App.Notification.Builder
Parameters
- behavior
- Int32
int: One of FOREGROUND_SERVICE_DEFAULT, FOREGROUND_SERVICE_IMMEDIATE, or FOREGROUND_SERVICE_DEFERRED Value is one of the following: Notification.FOREGROUND_SERVICE_DEFAULT Notification.FOREGROUND_SERVICE_IMMEDIATE Notification.FOREGROUND_SERVICE_DEFERRED
Returns
This Android.App.Notification.Builder instance, allowing calls to be chained.
- Attributes
Remarks
Specify a desired visibility policy for a Notification associated with a foreground service. By default, the system can choose to defer visibility of the notification for a short time after the service is started. Pass FOREGROUND_SERVICE_IMMEDIATE to this method in order to guarantee that visibility is never deferred. Pass FOREGROUND_SERVICE_DEFERRED to request that visibility is deferred whenever possible. Note that deferred visibility is not guaranteed. There may be some circumstances under which the system will show the foreground service's associated Notification immediately even when the app has used this method to explicitly request deferred display.
Android reference for android.app.Notification.Builder.setForegroundServiceBehavior.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.