Tag Archives: wakelock

9,614 views

Force Screen On – dont use WakeLock – use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) – Android sample

FLAG_KEEP_SCREEN_ON saving energy. Protects the battery if a user closing applications using the Return button on device. The device will returned to user screen mode settings. @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); //………. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }

Posted in Android Examples Code | Tagged , , | Comments Off on Force Screen On – dont use WakeLock – use getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) – Android sample
54,602 views

Turn screen ON OFF Android sample code

WakeLock, PowerManager,uses-permission Android sample. Main.java public class Main extends Activity { private SensorManager mSensorManager; private PowerManager mPowerManager; private WindowManager mWindowManager; private WakeLock mWakeLock; private Button button; private TextView textView;   /** Called when the activity is first created. */ @Override … Continue reading

Posted in Android Examples Code | Tagged , , , | Comments Off on Turn screen ON OFF Android sample code