0

It is possible to check how many time is the phone on since the last time was powered on ?

for example, i powered off the phone last night, and 12 hours ago i powered on the phone, so... i need to know how to get these 12 hours powered on value from the phone.

It is possible?

thanks

Pableras84
  • 1,195
  • 5
  • 18
  • 30

1 Answers1

1
elapsedRealTime()

will give you the time since the device was last booted

http://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()

Offbeatmammal
  • 7,970
  • 2
  • 33
  • 52
  • to convert the elapsed time in milliseconds to more human readable figures see http://stackoverflow.com/questions/625433/how-to-convert-milliseconds-to-x-mins-x-seconds-in-java (that call gives you how long since the phone was started not the time at which it was started) – Offbeatmammal Jan 30 '13 at 21:52