getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@Override protected void onResume() { super.onResume(); pManager = ((PowerManager) getSystemService(POWER_SERVICE)); mWakeLock = pManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); mWakeLock.acquire(); } @Override protected void onPause() { super.onPause(); if(null != mWakeLock){ mWakeLock.release(); } }
galaxy
mContentResolver = getContentResolver(); setLockPatternEnabled(false); public void setLockPatternEnabled(boolean enabled) { setBoolean(android.provider.Settings.System.LOCK_PATTERN_ENABLED, enabled); } private void setBoolean(String systemSettingKey, boolean enabled) { android.provider.Settings.System.putInt(mContentResolver, systemSettingKey, enabled ? 1 : 0); } 权限 <uses-permission android:name="android.permission.WRITE_SETTINGS" />
时间: 2024-10-18 06:43:06