The answer is already in this forum: http://groups.google.com/group/android-developers/browse_frm/thread/81d84efa68578924/e470ffd0dab85086?lnk=gst&q=screen_on#e470ffd0dab85086 (I simply searched for SCREEN_ON)
It seems the situation has not changed in SDK 1.5: For some reason, registering through Manifest does not work - only registering programmatically. In that thread, Dianne also points out another problem that you repeat above: Why do you need to set android:process=":remote"? It takes 2MB of additional valuable phone memory, without much additional value. Peli www.openintents.org On Jul 20, 3:58 pm, JP <[email protected]> wrote: > I've double checked my code and found I'm doing this slightly > differently, although the method above should also work. > > Strike "Register" broadcast receiver in the manifest - this seems to > be meerly a declaration of the receiver. No intent filters; I check > the specific event types _ON/_OFF in the receiver's onReceive() > method. > The key: I register the BroadcastReceiver manually, using > Context.registerReceiver(BroadcastReceiver receiver, IntentFilter > filter) > > On Jul 19, 8:22 pm, jiaoni <[email protected]> wrote: > > > Thanks, JP. I have added following lines in AndroidManifest.xml, but > > still cannot receive any message in my BroadcastReceiver's onReceive() > > method. Is there anything I did wrong, or may I need some permission > > to receive SCREEN_ON/SCREEN_OFF message? Please help. > > > <receiver android:name=".MessageReceiver" android:process=":remote"> > > <intent-filter> > > <action > > android:name="android.intent.action.SCREEN_ON"></action> > > <action android:name="android.intent.action.SCREEN_OFF"></action> > > </intent-filter> > > </receiver> > > > On Jul 18, 7:02 am, JP <[email protected]> wrote: > > > > 1. You need to create a subclass of BroadcastReceiver, override > > > onReceive(Context context, Intent intent). > > > In onReceive(), extract action from intent and catch ACTION_SCREEN_ON > > > and ACTION_SCREEN_OFF > > > 2. Next you need to register the BroadcastReceiver in > > > AndroidManifest.xml > > > > On Jul 17, 12:02 am, jiaoni <[email protected]> wrote: > > > > > How can I catchSCREEN_ON/SCREEN_OFF broadcasts? > > > > > I have tried for hours, but failed. Please help. > > > > > Thanks a lot. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

