I need to create a backup of my application which would include creating a backup of 2 databases and also the shared preferences using Google drive API. I was able to get th
Turns out the only issue was creating the file before actualy adding data to it. Called the constructor of my dbhelper before writing to the db file.
used the following code:
java.io.File dir = myContext.getDatabasePath("myDb.db");
mOutput = new FileOutputStream(outFileName);
byte[] mBuffer = new byte[1024];
int mLength;
while ((mLength = mInput.read(mBuffer)) > 0) {
mOutput.write(mBuffer, 0, mLength);
}
mOutput.flush();
Thanks for taking the effort to help guys !
I will definitely take a look at your SQLiteExample @seanpj. Will get back if i find it as a better solution.