próbować ten jeden
int val=android.provider.Settings.System.getInt(getContentResolver(),
SCREEN_OFF_TIMEOUT);
android.provider.Settings.System.putInt(getContentResolver(),
SCREEN_OFF_TIMEOUT, -1);
Toast.makeText(this, "Disabled Screen Timeout", Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = settings.edit();
editor.putInt("ScreenTimeout",val);
editor.commit();
}
} catch(Throwable er) {
Toast.makeText(this, "Error "+er.getMessage(), Toast.LENGTH_LONG).show();
}
że ustawi ekran off
wyłączyć klucz strażnika w android użytku
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
i używać permition
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
utrzymać ekran żywy
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
jak pan rozwiązać ten problem? –