Android SQL database backup file format to cloud

17 Views Asked by At

In my Android app I have a SQL database. The user adds some data in app and he is able to backup the db to Google drive.

This works fine, I am doing it like this example:

  String Path = getApplicationContext().getDatabasePath("mydbname.db").getAbsolutePath();
   File filePath = new File( Path);
   driveServiceHelper.createFilePDF(filePath).addOnSuccessListener(...)

and in driveServiceHelper.createFilePDF (part of code):

            com.google.api.services.drive.model.File fileMetaData = new com.google.api.services.drive.model.File();
            fileMetaData.setName("mydbname.db");
            FileContent mediaContent = new FileContent("application/vnd.sqlite3", filePath);
            myFile = mDriveService.files().create(fileMetaData, mediaContent).execute();

The problem is, on google drive it is stored as db file, easily read by ani SQl viewer. However I don't want anyone to stole the data from db, because it contains info that I have collected for years of experience (gardening).

Is there a way to store SQL db file in encrypted format or is there a way to upload only one table from that database? Actually I have 2 tables in db, one with data and second just with user data, which is related to table 1, but contains only ID's from first table, not data.

So I see as a better idea to backup only 2nd table with ID's and not whole db.

0

There are 0 best solutions below