Skip to content

Instantly share code, notes, and snippets.

@aont
Created February 5, 2015 08:27
Show Gist options
  • Select an option

  • Save aont/1806c5f45342c19cf980 to your computer and use it in GitHub Desktop.

Select an option

Save aont/1806c5f45342c19cf980 to your computer and use it in GitHub Desktop.
Android detect wakeup
#!/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