SCREEN_ON / SCREEN_OFF broadcast receiver gotcha!

In my project I needed to know when the screen was turned on and off while my app was running.
After a bit of searching i came accross these intent filters for a receiver.

	
				
			
			
				
			

Shockingly, this did not work.
After some searching around I finally came across this answer in stackoverflow.
http://stackoverflow.com/questions/1588061/android-how-to-receive-broadcast-intents-action-screen-on-off

What you have to do is register those intents manually in code using the registerReceiver() method on your activity

Hoping this post makes googling a little easier. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *