java - Android: time intervals with deep sleep (System.nanoTime(), System.currentTimeMillis(), SystemClock.elapsedRealtimeNanos()) -
i implementing application has minimum api level 14 (this important) , requires consistent interval measuring. no need ms precision, needs counting time (elapsed seconds). far, treat time intervals, knew these solutions:
system.nanotime()
- works great if android running, stops on deep sleep (this bad). system.currenttimemillis()
- good, not appropriate because can changed user or code setcurrenttimemillis(long)
. systemclock.elapsedrealtimenanos()
- counts elapsed time on deep sleep, requires api level 17. is there way reasonable second-precision interval measuring on api 14? i thought using system.currenttimemillis()
listening broadcast intents see if scheme clock has changed. not seem best solution.
have tried systemclock.elapsedrealtime() ?
java android time clock nanotime
No comments:
Post a Comment