Hi i have problem to detect the screen on and screen off events when my app closed. I can only detect the events when my app is active. I tried to place a broadcast receiver to receive an ACTION_SCREEN_ON and ACTION_SCREEN_OFF intents in androidmanifest.xml file, but it doesn't work. Please help me...
You can't receive the SCREEN_ON and SCREEN_OFF intents by placing the broadcast receiver in manifest file. A workable solution is to register the broadcast receiver in a service. You follow the steps below to implement the solution.
1. You create a broadcast receiver.
2. Then create a service to register the receiver.
3. Finally, in the manifest file you declare the service.
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: