「ios/android開発」ロック画面を禁止する方法

権限
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
参考コード
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);
}
参考コード2

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();
}
}

Android

Posted by arkgame