Last Mile Fleet Solution is currently available only to select customers. Contact sales to learn more.

ForegroundServiceManager

public class ForegroundServiceManager extends Object

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 initForegroundServiceManager(Application, Integer, String, NotificationContentProvider). Otherwise, a default notification will be provided.

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

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.