Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android check device running time since last reboot

Tags:

android

I wonder is there a way to get the time that the device has been running since last reboot?

like image 503
James Gu Avatar asked Jan 19 '14 06:01

James Gu


2 Answers

From: http://developer.android.com/reference/android/os/SystemClock.html

SystemClock.elapsedRealtime()

elapsedRealtime() and elapsedRealtimeNanos() return the time since the system was booted, and include deep sleep. This clock is guaranteed to be monotonic, and continues to tick even when the CPU is in power saving modes, so is the recommend basis for general purpose interval timing.

like image 109
Dannie Avatar answered Oct 20 '22 17:10

Dannie


Per the answer to this other question:

Go to Settings>About Phone>Status and scroll to the end of the options. You'll see the up time.

like image 35
Watki02 Avatar answered Oct 20 '22 17:10

Watki02