[android-developers] Broadcast for SCREEN OFF

2011-11-10 Thread Namrata
Hi,

I am trying to listen broadcast for Screen Off as follow

IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_SCREEN_OFF);
BroadcastReceiver mReceiver = new ScreenReceiver();
registerReceiver(mReceiver, filter);


But when screen locks somehow my ScreenReceiver is not getting a
braodcast. What could be wrong here?
I also tried declaring it in manifest, there too it didn't work.


Thanks in Advance

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Broadcast for SCREEN OFF

2011-11-10 Thread Dianne Hackborn
This only works with registerReceiver(), not when declared in the manifest.

Your filter looks fine, so you should be receiving it.  Try looking in the
log to make sure there isn't some message being printed there.

On Thu, Nov 10, 2011 at 3:52 AM, Namrata puranik.namr...@gmail.com wrote:

 Hi,

 I am trying to listen broadcast for Screen Off as follow

 IntentFilter filter = new IntentFilter();
 filter.addAction(Intent.ACTION_SCREEN_OFF);
 BroadcastReceiver mReceiver = new ScreenReceiver();
 registerReceiver(mReceiver, filter);


 But when screen locks somehow my ScreenReceiver is not getting a
 braodcast. What could be wrong here?
 I also tried declaring it in manifest, there too it didn't work.


 Thanks in Advance

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en