public class
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 (服务服务)
将服务移出前台。如果服务是最后一项使用常驻通知的服务,则管理器会删除该通知。
参数
服务 |
---|