Search code examples
androidsleepwakelockandroid-wake-lock

How to find if a phone is in sleep mode or not???


I want my application to run all time. It should execute a function when phone is in sleep mode and stop the execution when it is asleep. Can anyone post a sample code?

Thanks in advance.


Solution

  • I think you need to look into WakeLocks http://developer.android.com/reference/android/os/PowerManager.WakeLock.html