This class allows clients to share a persistent notification by using a common notification id.
If a client wants to share a persistent notification, they should use startForeground(Service)
and stopForeground(Service) to move their services in and out of the foreground. Clients can
customize the notification by implementing the NotificationContentProviderBase abstract
class before calling NavigationApi.initForegroundServiceManagerProvider(Application, Integer, NotificationContentProvider) or more simply
with NavigationApi.initForegroundServiceManagerMessageAndIntent(Application, Integer, String, Intent). Otherwise, a default
notification will be provided.
Nested Class Summary
| class | ForegroundServiceManager.ForegroundExpectedException | Exception thrown by ForegroundServiceManager, if the service cannot be moved to
foreground. |
|
Public Method Summary
| void |
startForeground(Service service)
Moves service into foreground.
|
| void |
stopForeground(Service service)
Moves service out of foreground.
|
| void |
updateNotification()
Re-renders the notification after asking
NotificationContentProvider for the most
recent version of the notification. |
Inherited Method Summary
Public Methods
public void startForeground (Service service)
Moves service into foreground.
Parameters
| service |
|---|
Throws
| ForegroundServiceManager.ForegroundExpectedException | if the service cannot be moved to foreground. |
|---|
public void stopForeground (Service service)
Moves service out of foreground. If service is the last service using the persistent notification, the manager deletes the notification.
Parameters
| service |
|---|
public void updateNotification ()
Re-renders the notification after asking NotificationContentProvider for the most
recent version of the notification.