Created
February 5, 2015 08:27
-
-
Save aont/1806c5f45342c19cf980 to your computer and use it in GitHub Desktop.
Android detect wakeup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| last_wake_time=0 | |
| while true | |
| IO.popen("adb shell dumpsys power") do |p| | |
| while line = p.gets | |
| if /mLastWakeTime=(\d+)/=~line | |
| if last_wake_time!=$1 | |
| last_wake_time=$1 | |
| puts last_wake_time | |
| end | |
| break | |
| end | |
| end | |
| end | |
| sleep 1 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment