DeviceInfo.getIdleTime() help me to do that for all the apps except video.

getIdleTime return seconds since last key or track wheel event is pressed. If I take video for a long time, there is no chance for the above events (keypress or trackball). So api return some duration even app is in active mode.