It is simpliest to keep the cacheExpirationMs value the same as minWaitTimeBetweenSyncMs value.įor usage with non-Android modules, Kronos provides access to the Kotlin-only base library called Kronos-Java, which depends on an externally provided local clock and a cache. The cache is valid for 1 minute by default. Kronos will perform a background sync if the cache is stale.For example, if you shorten the minWaitTimeBetweenSyncMs to 30 seconds, but leave the cacheExpirationMs to 1 minute, it will have no affect because the cache is still valid within the 1 minute window. Note that you should also supply a cacheExpirationMs value. If you want to change the frequency, supply the desired interval in milliseconds. Kronos attempts a synchronization at most once a minute.If none of the server respond within the given time, the sync operation will be considered a failure. If the NTP server fails to respond within the given time, the next server will be contacted. Lengthen or shorten the timeout value.Specify a list of NTP servers with which to sync.Allows you to log sync operation successes and errors, which maybe useful for custom analytics. You can customize the configuration by using AndroidClockFactory.createKronosClock with the following optional parameters: Kronos comes with a set of reasonable default configurations. Since it relies on system uptime, Kronos detects and requires a new sync after each reboot. KronosTime contains the currentTime and the timeSinceLastNtpSyncMs, which will be null if currentTime is coming from the device clock. To get metadata with an individual timestamp, use KronosClock.getCurrentTime(), which returns an instance of KronosTime. If you'd rather control the fallback, you can use getCurrentNtpTimeMs(), which returns null instead of falling back. If the NTP server cannot be reached or Kronos has not yet been synced, getCurrentTimeMs() will return time from the fallback clock and trigger syncInBackground().
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |