Merge pull request #2454 from twain47/key-value-backups
Use google key/value backup agent for settings and objectives
This commit is contained in:
commit
7db4481db9
|
@ -38,7 +38,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