YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.util.ExitRestartGuards Class Reference

The ExitRestartGuard of the app, with its mark in a preferences file of its own (not the settings: it is no setting). More...

Collaboration diagram for de.yaacc.util.ExitRestartGuards:
Collaboration graph

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).
 

Detailed Description

The ExitRestartGuard of the app, with its mark in a preferences file of its own (not the settings: it is no setting).

Member Function Documentation

◆ stopRestartedService()

static void de.yaacc.util.ExitRestartGuards.stopRestartedService ( Service service,
int notificationId )
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.


The documentation for this class was generated from the following file: