How to find whether phone is in sleep/idle mode for Android?
My problem is I am able to wake up the phone from sleepmode by using alarm manager
But when the
isScreenOn method returns only if the screen is on or off. It does not indicate the sleepy mode, because Android sleep mode is not same as Android screen off mode. In Android, sleep mode might come within milliseconds (depending on wakelocks) after screen off (idle mode) - but that's not guaranteed (referring to this post).
I think you can try using SystemClock.uptimeMillis(),SystemClock.elapsedRealtime() comparison.