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?

  • you can see everything that comes to you in the intent in debug. Personally, I doubt the reason comes. - Vladyslav Matviienko
  • metalurgus - so I also could not find, I decided to ask. Maybe there is some way to discern - pressing the button by the user was or was this some other program turned on the screen ... - Alexander
  • @Alexander you, as the author of the message, can roll back the edit in one click - roll back in the change history. Or just return “hello” back by simple editing (which is better if you really want to leave a greeting). Just local design rules mean no greetings. Up to the point that they are cut out automatically by enSO. "Hello - They do not greet here! - Well, excuse me .... - And do not apologize!" long ago became a local meme. You shouldn't react so violently to it :) - PashaPash ♦
  • PashaPash - well, I will not :) Not accepted, it is not accepted. - Alexander

0