There was an error while loading. Please reload this page.
We use JitPack to host the library.
Add this to your application's build.gradle file:
build.gradle
repositories { maven { url "https://jitpack.io" } } dependencies { // ... implementation 'com.github.instacart:truetime-android:<release-version>' }
In your application class start the TrueTime sync-er like so:
// App.kt class App : Application() { val trueTime = TrueTimeImpl() override fun onCreate() { super.onCreate() trueTime.sync() } }
Once TrueTime gets a fix with an NTP time server, you can simply use:
(application as App).trueTime.now()
Btw don't do ↑, inject TrueTime into your app and then just call trueTime.now()
trueTime.now()