Use google key/value store for settings and objectives backup
This commit is contained in:
parent
0ff7702b1a
commit
262a47a18d
2 changed files with 32 additions and 1 deletions
|
@ -37,7 +37,14 @@
|
|||
android:roundIcon="${appIconRound}"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.Launcher"
|
||||
android:fullBackupContent="true">
|
||||
android:fullBackupOnly="false"
|
||||
android:backupAgent=".utils.SPBackupAgent"
|
||||
android:restoreAnyVersion="true">
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.backup.api_key"
|
||||
android:value="AEdPqrEAAAAI3JiApyMrbP2QFzZ2fYfCPsgjkRp53Dm2S1-zPQ" />
|
||||
|
||||
<meta-data
|
||||
android:name="com.google.android.gms.car.application"
|
||||
android:resource="@xml/automotive_app_desc" />
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
|
||||
import android.app.backup.BackupAgentHelper;
|
||||
import android.app.backup.SharedPreferencesBackupHelper;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
||||
public class SPBackupAgent extends BackupAgentHelper {
|
||||
|
||||
// API 24
|
||||
//static final String PREFS = PreferenceManager.getDefaultSharedPreferencesName(MainApp.instance().getApplicationContext());
|
||||
static final String PREFS = MainApp.instance().getApplicationContext().getPackageName() + "_preferences";
|
||||
|
||||
static final String PREFS_BACKUP_KEY = "SP";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
SharedPreferencesBackupHelper helper =
|
||||
new SharedPreferencesBackupHelper(this, PREFS);
|
||||
addHelper(PREFS_BACKUP_KEY, helper);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue