Notification.Builder.SetForegroundServiceBehavior(Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为与前台服务关联的通知指定所需的可见性策略。
[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
参数
- behavior
- Int32
int:FOREGROUND_SERVICE_DEFAULT、FOREGROUND_SERVICE_IMMEDIATE或FOREGROUND_SERVICE_DEFERRED值之一是下列值之一:Notification.FOREGROUND_SERVICE_DEFAULT Notification.FOREGROUND_SERVICE_IMMEDIATE Notification.FOREGROUND_SERVICE_DEFERRED
返回
此 Android.App.Notification.Builder 实例允许链接调用。
- 特性
注解
为与前台服务关联的通知指定所需的可见性策略。 默认情况下,系统可以选择在服务启动后将通知的可见性推迟一小段时间。 将FOREGROUND_SERVICE_IMMEDIATE传递给此方法,以确保不会延迟可见性。 传递FOREGROUND_SERVICE_DEFERRED以请求尽可能延迟可见性。 请注意,无法保证延迟的可见性。 在某些情况下,即使应用已使用此方法显式请求延迟显示,系统也会立即显示前台服务的关联通知。
Android 参考。android.app.Notification.Builder.setForegroundServiceBehavior
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。