Here are the events, Intent.ACTION_SCREEN_ON and Intent.ACTION_SCREEN_OFF . Is it possible to find out why events occurred (the user woke up the phone, the incoming call or some WhatsApp drew his window and lit the screen). To distinguish the situation when my program needs to react, and when not.
This is still a problem. Now I’ve found out a serious jamb - a person has an alarm clock set, and when it is triggered (the screen lights up), my application pops up, the alarm goes into the background and doesn’t ring (apparently the owner turns it off?) And they say the same trouble listen - also when the track ends (probably the player also lights the screen), my application pops up. How to teach the app to wake up only when the screen is lit from the button?