-
public final class SecureEntryClockClass dedicated to syncing the time with an NTP server to get the actual time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSecureEntryClock.CallbackCallback interface used for receiving a response on the UI thread.Note: This is not required for calling syncTime but it isimportant to note that the call will always be asynchronous.
-
Method Summary
Modifier and Type Method Description static SecureEntryClockgetInstance(@NonNull() Context ctx)Creates and returns the singleton instance of SecureEntryClock static SecureEntryClockgetInstance(@NonNull() Context ctx, String host)Creates and returns the singleton instance of SecureEntryClock with a custom NTP host Datenow()Returns the cached time if there is one. voidsyncTime()Syncs time with the NTP server without providing a response. voidsyncTime(@Nullable() SecureEntryClock.Callback callback)Syncs time with the NTP server and provides a response via the Callback. static voidreset()Purges the storage in SharedPreferences for the cached time. -
-
Method Detail
-
getInstance
static SecureEntryClock getInstance(@NonNull() Context ctx)
Creates and returns the singleton instance of SecureEntryClock
- Parameters:
ctx- application context
-
getInstance
static SecureEntryClock getInstance(@NonNull() Context ctx, String host)
Creates and returns the singleton instance of SecureEntryClock with a custom NTP host
- Parameters:
ctx- application context
-
syncTime
void syncTime()
Syncs time with the NTP server without providing a response.
-
syncTime
void syncTime(@Nullable() SecureEntryClock.Callback callback)
Syncs time with the NTP server and provides a response via the Callback.
- Parameters:
callback- an interface for receiving a response from the time sync
-
reset
static void reset()
Purges the storage in SharedPreferences for the cached time.
-
-
-
-