Package com.tapkey.mobile.broadcast
Class PollingScheduler
- java.lang.Object
-
- android.content.BroadcastReceiver
-
- com.tapkey.mobile.broadcast.PollingScheduler
-
public class PollingScheduler extends android.content.BroadcastReceiver
Schedules polling for updates from the Tapkey Trust Service. Most notably instances of this class poll for updated access keys on a periodic base. The app'sApplication
instance must implement theTapkeyAppContext
interface in order for this class to function. This class is used by registering it via itsregister(Context, int, int)
method.PollingScheduler.register(this, uniqueJobId, PollingScheduler.DEFAULT_INTERVAL);
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INTERVAL
The default polling interval of eight hours.
-
Constructor Summary
Constructors Constructor Description PollingScheduler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onReceive(android.content.Context context, android.content.Intent intent)
static Closeable
register(android.content.Context context, int jobId, int intervalMs)
Registers polling for Tapkey notifications.-
Methods inherited from class android.content.BroadcastReceiver
abortBroadcast, clearAbortBroadcast, getAbortBroadcast, getDebugUnregister, getResultCode, getResultData, getResultExtras, goAsync, isInitialStickyBroadcast, isOrderedBroadcast, peekService, setDebugUnregister, setOrderedHint, setResult, setResultCode, setResultData, setResultExtras
-
-
-
-
Field Detail
-
DEFAULT_INTERVAL
public static final int DEFAULT_INTERVAL
The default polling interval of eight hours.- See Also:
- Constant Field Values
-
-
Method Detail
-
onReceive
public void onReceive(android.content.Context context, android.content.Intent intent)
- Specified by:
onReceive
in classandroid.content.BroadcastReceiver
-
register
@RequiresPermission(allOf="android.permission.RECEIVE_BOOT_COMPLETED") public static Closeable register(android.content.Context context, int jobId, int intervalMs)
Registers polling for Tapkey notifications. The given jobId must be application-wide. The interval is approximate. The decision when the job will be executed will be made by Android itself and depends of several factors like battery level, network connection, etc.- Parameters:
context
- the Android Context.jobId
- an application-wide unique job ID.intervalMs
- the polling interval.- Returns:
- a Closable which can deregister services and receivers. ToDo: Document why RECEIVE_BOOT_COMPLETED permission is required
-
-