views:

37

answers:

1

How do you discover when, in the future, the device is expected to sleep?

Or, at least, when the last user activity was?

+1  A: 

How do you discover when, in the future, the device is expected to sleep?

You don't. There is no API for this. The device will go to sleep after the user-specified timeout has elapsed and after all outstanding WakeLocks are released. It is impossible to predict when the device will go to sleep, since the OS has no idea when those WakeLocks will be released.

CommonsWare