|
YAACC - UPNP Client and Server
|
The ExitRestartGuard of the app, with its mark in a preferences file of its own (not the settings: it is no setting).
More...

Static Public Member Functions | |
| static synchronized ExitRestartGuard | of (Context context) |
| The one guard of the process (the in-process "the user started" state is shared by the application, the services and the screens). | |
| static void | stopRestartedService (Service service, int notificationId) |
Ends a service that the system restarted right after an explicit exit (null intent in onStartCommand). | |
The ExitRestartGuard of the app, with its mark in a preferences file of its own (not the settings: it is no setting).
|
static |
Ends a service that the system restarted right after an explicit exit (null intent in onStartCommand).
A null intent never comes from startForegroundService() (that always carries an intent), so the system's own restart is the only entry and it is not "foreground required"; but a service that was started that way and does not call startForeground() in time raises a ForegroundServiceDidNotStartInTimeException on Android 12 and newer, and this can not be verified by reading. So the path is made safe where it costs little: the smallest possible notification goes up and comes down again in the same call (a flash is acceptable, a crash is not), and then the service stops. Every step is guarded: a refused startForeground (background start limits) must not keep the service from stopping.