Hi, I'm trying to do a simple test, where the screen turn off and on
several times. something like that:

        new CountDownTimer(2000, 1000) {
//              boolean change = true;
            public void onTick(long millisUntilFinished) {

                if(change){
                Toast.makeText(getApplicationContext(), "SCREEN OFF!",
Toast.LENGTH_SHORT).show();
                change = false;
                lp.screenBrightness = 0;
                        getWindow().setAttributes(lp);
                }
                else{
                        Toast.makeText(getApplicationContext(), "SCREEN ON!",
Toast.LENGTH_SHORT).show();
                        change = true;

                  lp.screenBrightness = 1;
                        getWindow().setAttributes(lp);
                }
            }

            public void onFinish() {

            }
         }.start();

But, when i run the application, the screen turns off and doesnt come
back, so, i though i should disable the keyguard, and i done that wich
this:

                //unlock phone
        KeyguardManager km = (KeyguardManager)
getSystemService(Context.KEYGUARD_SERVICE);
        KeyguardLock mKeyguardLock = km.newKeyguardLock("TEST");
        mKeyguardLock.disableKeyguard();

But, using this, i still have to press the power button to turn the
screen on again.... So i tryed to wake up it with this:
      //wake phone
        PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
        PowerManager.WakeLock mWakeLock =
pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK |
PowerManager.ACQUIRE_CAUSES_WAKEUP, "TEST");
        mWakeLock.acquire();
        mWakeLock.release();


But without success.... i tried something with system settings too,
but i dont know how to use it, so i tryed this:

android.provider.Settings.System.putInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE,
android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
        android.provider.Settings.System.putInt(getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS, 1);

Can comeone please  help me?

-- 
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

Reply via email to