public class ApplicationWatchdogManager extends java.lang.Object
It allows you to initialize the application watchdog service for your application in order to shut it down in case of failure. It also allows to execute a pending intent after application is terminated.
Unless noted, all application watchdog API methods require the
com.digi.android.permission.WATCHDOG permission. If your
application does not have this permission it will not be able to interact
with the application watchdog API.
|Modifier and Type||Field and Description|
Minimum configurable timeout for the application watchdog service: 500L milliseconds.
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns the configured application watchdog service timeout for the calling application.
Initializes the application watchdog service for the calling application with the given timeout (in milliseconds).
Returns whether the application watchdog service has been initialized for the calling application or not.
Refreshes your application watchdog.
Stops the application watchdog service for the calling application.
public static final long MINIMUM_WATCHDOG_TIMEOUT
public ApplicationWatchdogManager(android.content.Context context)
ApplicationWatchdogManagerfor the given application.
ApplicationWatchdogManager allows your application to
interact with the application watchdog service.
context- Android application context for which the application watchdog manager will be instantiated.
context == null.
public void init(long timeout, android.app.PendingIntent pendingIntent)
This method registers the calling application to the application watchdog service in order to take specific actions on application failure. If the application fails to refresh the watchdog in the specified timeout, the application will be shut down and the given pending intent will be executed. This pending intent can be used to restart application when it fails.
Your application will be automatically removed from the application watchdog service once it is shut down due to failure. It is your responsibility to stop the application watchdog service on your application if it is manually terminated. The application watchdog service must be initialized again in your application once it is shut down and restarted.
You can remove your application from the application watchdog service
timeout- Watchdog timeout in milliseconds.
pendingIntent- Pending intent to execute when application is shut down due to watchdog timeout. Can be
timeoutis not valid.
java.lang.UnsupportedOperationException- If the application watchdog service has been already initialized for the calling application.
public long getTimeout()
This method can only be called once the application watchdog service
has been initialized for the calling application, otherwise an
UnsupportedOperationException will be thrown.
java.lang.UnsupportedOperationException- If the application watchdog service has not been initialized for the calling application.
public boolean isRunning()
public void stop()
Following this call, the application is no longer required to send refresh requests to the application watchdog service.