前景服務管理員

公用類別 ForegroundServiceManager 擴充物件

這個類別可讓用戶端使用通用通知 ID 分享持續性通知。如果用戶端想分享常駐通知,則應使用 startForeground(Service)stopForeground(Service) 將服務移入或移出前景。用戶端可以在呼叫 initForegroundServiceManager(Application, Integer, String, NotificationContentProvider) 前實作 NotificationContentProviderBase 抽象類別,藉此自訂通知。如未設定,系統會提供預設通知。

公用方法摘要

void
startForeground(服務)
將服務移至前景。
void
stopForeground(服務)
將服務移出前景。
void
updateNotification()
要求 NotificationContentProvider 取得最新的通知版本後,重新轉譯通知。

繼承方法摘要

公用方法

public void startForeground (服務服務)

將服務移至前景。

參數
服務

public void stopForeground (服務服務)

將服務移出前景。如果服務是最後一個使用持續性通知的服務,管理員會刪除通知。

參數
服務

public void updateNotification ()

要求 NotificationContentProvider 取得最新的通知版本後,重新轉譯通知。