I want to find a reliable way to detect if a user stopped using his phone for a while. When this is the case, I want to show some dialog to the user. I thought about a few methods, but I'm not sure which one is realizable.
- If a user did not touch his screen for a while (e.g. 1 minute) and the audio system is inactive*, he most likely stopped using his phone and did something else. In my opinion, this should be quite reliable, but I'm not sure, if it is realizable. Is it?
- Almost like method #1, but this time if the screen was off for a while. This should be realizable using Broadcast Receivers (
ACTION_SCREEN_OFF
: save time;ACTION_SCREEN_ON
: check, ifnow - saved_time > 1 min
). Am I correct? - The phone was not moved for a while. This would, however, not cover the cases where the user puts the phone in his pocket. So it would possibly only be reliable in combination with something else.
Do you come across other ways to realize this use case? And do you come across concrete implementation ideas? Which problems do you see in the mentioned methods? Thanks in advance!
*Because otherwise he could listen to music or watch some videos. What about muted videos?