Android Database Restore

Thanks for the offer but I've spent the evening working out Cloud Firestore and I think I'm ready to just implement that. It will kill two birds with one stone as it means you can log in and data will be stored in the cloud... which was kind of what I wanted anyway!

For now I'll just setup and export and import, I guess clearing the Store and writing info from the device each time in full. Very inefficient but the quickest way to get a backup/restore working again. Then I might look to record everything using the Firestore... but this might be too much work tbh.
 
Not sure if you have resolved it or not and i'm few weeks late but have you tried making sure your directory to the external "sdcard" you created originally set executable, readable and writable true?
The .getExternalStorageDirectory is what I have in my current project to access the sdcard directory but I had problem writing files into the directory I needed to set those premise to make it work.
Works for me on my XZ2 and Honor8 which is my 2 physical device I'm using for testing.
My latest project is written in Kotlin but you should be able to figure out what i've done:
val fileDirectory : File = File(Environment.getExternalStorageDirectory().path )
try{
val main_folder : String = "FOLDER_NAME"

val folderAvailable = File(fileDirectory.path + "/" + main_folder)
fileName = fileNameIn

if (!folderAvailable.exists()){ //Doesn't exist then create the folder
folderAvailable.mkdirs()
folderAvailable.setExecutable(true)
folderAvailable.setReadable(true)
folderAvailable.setWritable(true)
}
}catch(Exception){}
 
Interesting, thanks. It could have been that, I've pulled all that code now. My new code using Cloud Firestore works better anyway, one button backup to the cloud is preferable I think and seems to work great.

Mind you, I might be the only person that cares. I just checked, just me and a mate that I know uses it have backed up. Still, it was mainly for me that I wanted it working anyway! I have years of data in this app now!
 
It is quite a faff though that after every OS release, something has to be changed to make it work. The only thing I don't like from android development side in my opinion.
Glad you got it working though.
 
Back
Top Bottom