Hello I created my first app with Android studio, I need to Backup /restore
data each time user add new record to Database, but untill now
requestBackup is not working. when I tested by : adb shell bmgr backup
<package> adb shell bmgr run adb shell bmgr restore <package> It works, but
not automaticly Here my files
Manifest------------------------------------------------------------------------------------------------------------------------------------
<application android:allowBackup="true"
android:backupAgent="TheBackupAgent" <meta-data
android:name="com.google.android.backup.api_key"
android:value="WWWWWWWWWWWWWWWWWWWWWWWW \>
--------------------------------------------------------------------------------------------------------------------------------------------------
TheBackupAgent-----------------------------------------------------------------------------------------------------------------------
public class TheBackupAgent extends BackupAgentHelper { String
DATABASE_NAME = "caisses"; String DATABASE_FILE_NAME = "caisses.db";
@Override public void onCreate() { FileBackupHelper dbs = new
FileBackupHelper(this, DATABASE_FILE_NAME); addHelper("dbs", dbs); }
@Override public File getFilesDir() { File path =
getDatabasePath(DATABASE_FILE_NAME); return path.getParentFile(); } public
static void requestBackup(Context context) { BackupManager bm = new
BackupManager(context); bm.dataChanged(); } }
--------------------------------------------------------------------------------------------------------------------------------------------------
Activity add Operation to
database-------------------------------------------------------------------------------------------
mabase.insertOperation(id_client, id_type, IO,
Integer.parseInt(date_en_chiffre.toString()), date.getText().toString());
Toast.makeText(getBaseContext(), "Enregistré avec succès, OK",
Toast.LENGTH_SHORT).show();
TheBackupAgent.requestBackup(New_Operation.this);
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/c88d8208-067e-4fa0-8daa-692f135d35e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.