Monday, June 6, 2011

[android-developers] Re: Handling Screen OFF and Screen ON Intents

for more detail: http://androidorange.blogspot.com/2011/06/manipulation-screen-off-and-screen-on.html

On Jun 6, 2:20 pm, souissi haythem <haythe...@gmail.com> wrote:
> it's good I got the answer hearhttp://groups.google.com/group/android-developers/browse_frm/thread/8...
>
> => Screen_on/off not working via the manifest
>
> thank u mark :)
>
> On Jun 6, 1:45 pm, souissi haythem <haythe...@gmail.com> wrote:
>
> > I CHANGED IT INTO LOG
>
> > Log.e("ON","Device Haythem SCREEN TURNED ON");
> > Log.e("Off","Device Haythem SCREEN TURNED Off");
>
> > it still not working???
>
> > On Jun 6, 1:00 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > > 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 <haythe...@gmail.com> 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 android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscribe@googlegroups.com
> > > > 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/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment