One problem is that you are using Toasts instead of logging to LogCat with the android.util.Log class.
On Mon, Jun 6, 2011 at 5:15 AM, souissi haythem <[email protected]> wrote: > I'm trying to get a BroadcastReceiver invoked when the screen is > turned on or off. > > In my AndroidManifest.xml I have specified : > > <receiver android:name=".ScreenReceiver"> > <intent-filter> > <action > android:name="android.intent.action.SCREEN_ON"></action> > <category > android:name="android.intent.category.HOME"/> > </intent-filter> > </receiver> > > <receiver android:name=".ScreenReceiver1"> > <intent-filter> > <action > android:name="android.intent.action.SCREEN_OFF"></ > action> > <category > android:name="android.intent.category.HOME"/> > </intent-filter> > </receiver> > > In my ScreenReceiver.java I have specified : > > public void onReceive(Context context, Intent intent) { > try { > Toast.makeText(context, "Device Haythem SCREEN TURNED > ON", Toast.LENGTH_LONG).show(); > } catch (Exception e) { > } > > } > > In my ScreenReceiver1.java I have specified : > > public void onReceive(Context context, Intent intent) { > try { > Toast.makeText(context, "Device Haythem SCREEN TURNED > OFF", Toast.LENGTH_LONG).show(); > } catch (Exception e) { > } > > } > > it don't work. My device didn't detect anythink. > > Please what's the problem??? > > Thanks > > -- > 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 > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9.3 Available! -- 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

