java - Android: time intervals with deep sleep (System.nanoTime(), System.currentTimeMillis(), SystemClock.elapsedRealtimeNanos()) -


I am implementing an application in which the minimum API level is 14 (this is important) and it is used to measure frequent interval the wanted. There is no need for MS precision, it should always calculate the time (spent seconds).

So far, for the treatment of time intervals, I knew these solutions:

  1. System.nanoTime () - If Android is running It works so well, but closes on deep sleep (it is bad).
  2. System.currentTimeMillis () - Good, but not fair because it's by user or code by SetCurrentTimeMillis (long) .
  3. SystemClock.elapsedReautimeNanos () - Time has passed on deep sleep, but API level 17 is required.

    is there any other way of measuring an appropriate second precision interval to measure on API 14?
    I used to think about using System.currentTimeMillis () to listen to the broadcast clock or not that the system clock has changed. Although this does not seem to be the best solution.

    Have you tried?

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -