Nie można, jak napisano w Official Android 4.2 API Documentation
Some device settings defined by Settings.System
are now read-only. If your app attempts to write changes to settings defined in Settings.System
that have moved to Settings.Global
, the write operation will silently fail when running on Android 4.2 and higher. Even if your value for android:targetSdkVersion
and android:minSdkVersion
is lower than 17, your app is not able to modify the settings that have moved to Settings.Global
when running on Android 4.2 and higher.
Jednakże, jeśli jesteś OS Developer, można napisać go po ustawieniu tych uprawnień
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
Następnie do zapisu i odczytu ,
// To Write
Settings.Global.putString(getContentResolver(), "airplane_mode_on", "1");
// To Read
String result = Settings.Global.getString(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON);
Toast.makeText(this, "result:"+result, Toast.LENGTH_SHORT).show();
NAPRAWDĘ? Czemu? Czy czytasz coś o tym? Dzięki ... – Meroelyth
http://commonsware.com/blog/2012/11/20/miscellaneous-android-4p2-regressions.html – CommonsWare