use apply() with all SharedPreferences

if the code does not check the result of commit() it should use apply()
since that runs in the background.
This commit is contained in:
Hans-Christoph Steiner 2016-10-10 09:44:18 +02:00
parent d8e83c7c9c
commit 15181d47f5

View File

@ -331,7 +331,7 @@ public class SwapService extends Service {
// ========================================== // ==========================================
private void persistAppsToSwap() { private void persistAppsToSwap() {
persistence().edit().putString(KEY_APPS_TO_SWAP, serializePackages(appsToSwap)).commit(); persistence().edit().putString(KEY_APPS_TO_SWAP, serializePackages(appsToSwap)).apply();
} }
/** /**
@ -398,7 +398,7 @@ public class SwapService extends Service {
persistence().edit() persistence().edit()
.putBoolean(KEY_BLUETOOTH_ENABLED, bluetoothSwap.isConnected()) .putBoolean(KEY_BLUETOOTH_ENABLED, bluetoothSwap.isConnected())
.putBoolean(KEY_WIFI_ENABLED, wifiSwap.isConnected()) .putBoolean(KEY_WIFI_ENABLED, wifiSwap.isConnected())
.commit(); .apply();
} }
}; };