Google Drive Android api - Downloading db file from drive

后端 未结 2 475
感动是毒
感动是毒 2021-01-07 10:12

I am using the below code for downloading an already uploaded sqlite db file from google drive to the data/data/packagename/databases folder, but when the method completes,

2条回答
  •  终归单人心
    2021-01-07 10:16

    I was able to finally fix my own issue, by replacing the file.openContents with file.open and setting a result call back with DriveContents result back rather than ContentsResult.

    Also, used the DriveContents to set an InputStream on the same (initially opened in Mode_Read_Only in open method) and then writing it out into a physical ".db" file on the data base path location.

    Now, the database doesn't get corrupted and restores data successfully.

提交回复
热议问题