instacart / truetime-android

Android NTP time library. Get the true current time impervious to device clock time changes
https://tech.instacart.com/truetime/
Apache License 2.0
1.42k stars 194 forks source link

Removed boot receiver. Added reboot handling by boot id. #93

Open martinfilipekcz opened 6 years ago

martinfilipekcz commented 6 years ago

I do not know where to put the method exactly. Feel free to put it where it's the best place by you. Problem is with custom CacheInterface implementation. But the basic logic is there.

mmitic-lotusflare commented 6 years ago

That looks 10x better than boot receiver solution (which doesn't really work). I'm assuming using /proc/sys/kernel/random/boot_id is safe on Android devices? Any idea of some Android versions where this is not supported?

martinfilipekcz commented 6 years ago

I cant tell if it is save on every device only thing that I know is that from M api version you cant access /proc/sys/kernel/random/boot_id but for that is there logic with BOOT_COUNT. We are using it in our app(about 11k users) and doesn't seem single crash.

gerc99 commented 5 years ago

DISK_CACHE_CLIENT.cacheBootId(bootId.toString()); clearCachedInfo(); this is mistake, first record, followed by purification

karangoel16 commented 5 years ago

+1

karangoel16 commented 5 years ago

DISK_CACHE_CLIENT.cacheBootId(bootId.toString()); clearCachedInfo(); this is mistake, first record, followed by purification

clearcacheInfo does not clear bootId

_cacheInterface.put(KEY_CACHED_BOOT_TIME, bootTime); _cacheInterface.put(KEY_CACHED_DEVICE_UPTIME, cachedDeviceUptime); _cacheInterface.put(KEY_CACHED_SNTP_TIME, cachedSntpTime);

mhenhoeffer commented 5 years ago

I have run into this issue in the app I'm working on and going to test this change out shortly. I see that this PR has been sitting for quite a while and wondering if this change is not going to make it in or if I'm going to have to do something custom in the app. Any thoughts?

vandus commented 5 years ago

+1

kaushikgopal commented 1 year ago

@martinfilipekcz 🙏 thank you for the suggestions. I apologize for this PR going stale. TrueTime has since undergone massive changes with the migration to Kotlin + Coroutines. We've picked it back up and are revamping it in earnest.

Would you be up for trying to implement the solution you suggested via BOOT_COUNT and shooting a PR up for this? You might have to abandon this PR as the 4.0 is a complete overhaul (apologies in advance for this).