waistline icon indicating copy to clipboard operation
waistline copied to clipboard

[Feature request] Database backup to custom folder

Open schklom opened this issue 1 year ago • 14 comments

Database backups are a pain to find and backup properly (in /Android/data/com.waist.line/files). Is it possible to add a button somewhere to pick a folder where we want to save the backup?

schklom avatar Aug 22 '23 23:08 schklom

On versions prior to Android 13, the backup files are saved to the Documents folder which is very accessible. But on Android 13 and above, the backup files must be saved to a different folder for technical reasons, see #738 and #733.

EmilJunker avatar Aug 23 '23 05:08 EmilJunker

@EmilJunker is that actually the case? WaistLine is the only app I have on Android13 that doesn't let me choose a backup location.

Is there any option around this, as on my device I do not have access to Android/data/com.waist.line/files via a file browser (e.g. Material Files) to do an off phone backup of the export?

grrrrr avatar Aug 31 '23 14:08 grrrrr

@grrrrr I'm able to access the backup location using this file browser app from the Play Store: https://play.google.com/store/apps/details?id=com.marc.files

In the future, maybe we can implement a solution where the exported file can be shared with other apps via Android's native sharing widget (a suggestion from #744). This Cordova plugin looks like it might allow to do just that: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

EmilJunker avatar Aug 31 '23 16:08 EmilJunker

Thanks for checking, I am de-googled so can't get that to try but at least those I've tried on f-droid don't have access, no root access error.

But sure I can wait for a share option and hope in the mean time no need to re-install :)

grrrrr avatar Aug 31 '23 16:08 grrrrr

The com.marc.files app is basically just a shortcut that opens the system file browser. I don't think it requires any Google APIs or Play services. You can just download the APK from here: https://www.apkmirror.com/apk/marc-apps-software/files-20/

EmilJunker avatar Aug 31 '23 17:08 EmilJunker

I grabbed it via adb in the end :D

grrrrr avatar Aug 31 '23 17:08 grrrrr

@EmilJunker Is it possible to backup to a less protected storage location like Android/media/com.waist.line/files instead? Most apps do not even try to allow access to Android/data/..., but Android/media/... is much easier to access. Backing up a folder there can be done by every backup app I tried (Nextcloud, FolderSync, Tasker) without requiring any tricks.

Alternatively, would it be possible to use the Storage Access Framework to define the backup location? A quick search shows that there are cordova plugins to do that https://github.com/customautosys/cordova-plugin-saf-mediastore

schklom avatar Sep 01 '23 11:09 schklom

Is it possible to backup to a less protected storage location like Android/media/com.waist.line/files instead?

I just tried that using the trick described in https://github.com/davidhealey/waistline/issues/252#issuecomment-932939576, but it looks like it's no longer working. It worked on older versions of Android but when I try it on an Android 13 device I always get "Export failed".

As I wrote above, I think our best option would be to implement a solution where the exported file can be shared with other apps via Android's native sharing widget.

EmilJunker avatar Sep 09 '23 16:09 EmilJunker

I attempted to backup my database as well on android 13 and while the popup said it went to /Android/data/com.waist.line/files/waistline_export.json there was no directory "com.waist.line" under /Android/data/

I assume it has just backed up the file to the container's directory path rather than the android host's path because the host's was not symlinked.

Nitrousoxide avatar Nov 25 '23 17:11 Nitrousoxide

there was no directory "com.waist.line" under /Android/data/

@Nitrousoxide Make sure you are using a file browser that actually lets you access the files under /Android/data/. Not all file browser apps do that. This one works for me: https://play.google.com/store/apps/details?id=com.marc.files https://www.apkmirror.com/apk/marc-apps-software/files-20/

EmilJunker avatar Nov 25 '23 19:11 EmilJunker

There should be hundreds of folders under /Android/Data. One for each app on your phone. If you only see so few folders, then there is something fishy going on. Please try a different file browser.

EmilJunker avatar Nov 25 '23 19:11 EmilJunker

Using Marc's "Files" app seems to make them visible. Looking into that app it seems like its just an aliased link to the built-in file browser for android so it doesn't suffer the permission issues other ones do in modern android 13. So that's a good install regardless of your situation!

Nitrousoxide avatar Nov 25 '23 20:11 Nitrousoxide

+1

BenediktBroich avatar Jan 31 '24 12:01 BenediktBroich

Just chipping in to say that waistline is the only app atm where I can't (automatically) backup data. Most other apps I've setup backups for (via syncthing, foldersync, etc) have the backup data under /Android/media, so with the right permissions its possible for those apps to access the to-be-backed-up data and put it where-ever I think is a good idea. For waistline, that's unfortunately not possible (with Android 14, anyway), so the only way to backup the data would be to copy it manually out of that folder (via the "Files" app mentioned above), or maybe use the Google backup mechanism (which I'd like to avoid because it doesn't give a lot of control where my data is stored).

makkus avatar Mar 25 '24 09:03 makkus