屏幕高亮

1.<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
2.public class test extends Activity {
PowerManager powerManager = null;
WakeLock wakeLock = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
this.powerManager = (PowerManager)this.getSystemService(Context.POWER_SERVICE); this.wakeLock = this.powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Lock");
}

@Override
protected void onResume() {
super.onResume();
this.wakeLock.acquire();
}

@Override
protected void onPause() {
super.onPause();
this.wakeLock.release();
}

}

你可能感兴趣的:(powermanager)