IOS Android 禁止锁屏
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" />
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。