語言

Notification.Builder.SetForegroundServiceBehavior(Int32) 方法

定義

指定與前景服務相關的通知所需的可見性政策。

[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

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於