Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Backup doesn't work #66

Closed
Smile85363 opened this issue Nov 9, 2022 · 18 comments
Closed

[Bug] Backup doesn't work #66

Smile85363 opened this issue Nov 9, 2022 · 18 comments
Labels
Enhancement Enhance existing feature

Comments

@Smile85363
Copy link

It didn't work, neither in automatic mode nor when I tried to make it manually. I changed folders and backup locations, but nothing changes

@Smile85363 Smile85363 added the Enhancement Enhance existing feature label Nov 9, 2022
@keshav-space
Copy link
Owner

Few things needed
Device: ??
OS and Version: ??
SafeNotes Version: ??
ScreenShot of Backup Page: ??

@landry314
Copy link

I have the same problem and have discussed it a lot in issue #58. i wonder how many people are not able to backup. what operating system and version are you on?

@ghoevil
Copy link
Contributor

ghoevil commented Nov 13, 2022

@keshav-space I also met the same bugs, no matter to use auto, or backup now, or manual export.

@ghoevil
Copy link
Contributor

ghoevil commented Nov 13, 2022

@keshav-space

You can see the photos as below.

zFt3wj.jpg

zFtM6S.jpg

zFtuSf.jpg

@landry314
Copy link

even though i disabled secure display, still screenshots are just black. i cant show you. nothing happens. no backup is ever made. it was made in version 1.0. i still have a "vault" file from then.

@ghoevil
Copy link
Contributor

ghoevil commented Nov 13, 2022

@landry314 You have to Kill it from the background run after disable,and re-open the app. It will be able to let you make screenshot.

@keshav-space
Copy link
Owner

keshav-space commented Nov 13, 2022

The v2.0.2-beta release is out and it should fix this issue.
Do test this out and let me know if it's working. safenotes-v2.0.2-beta.apk

What was causing backup and export to fail?

After doing some research on this it turns out that to store files in generic user-desired locations or to do backups the app needs to have MANAGE_EXTERNAL_STORAGE permission.

it was made in version 1.0. i still have a "vault" file from then.

In v1.0 export were directly saved in the download folder which is accessible by apps without using MANAGE_EXTERNAL_STORAGE permission.
But to save files anywhere outside app-specific storage space is not consistently possible without MANAGE_EXTERNAL_STORAGE, for some OS it might work for some it might not and that is expected behavior.

Moreover, for the backup to work - the same backup file is periodically updated which is not possible with novice create document intent

Note: ACTION_CREATE_DOCUMENT cannot overwrite an existing file. If your app tries to save a file with the same name, the system appends a number in parentheses at the end of the file name.

For example, if your app tries to save a file called confirmation.pdf in a directory that already has a file with that name, the system saves the new file with the name confirmation(1).pdf.

References

@landry314
Copy link

Well, what you could do, is maintain a few versions of backups for x days, labeling them with their date then delete the oldest backup while replacing it with the newest. This is good in case the user makes a mistake deleting data and solves the file naming problem above.

I am still stuck on the fdroid signature version or I would beta test.

I tried selecting the /Download folder but it won't let me which is funny because in version 1.0 that was the ONLY option. It will let me choose any other folder on /sdcard/ which is not protected space but it wont actually write to it...

@landry314
Copy link

Oh, good news, I was able to create a folder INSIDE /Download and create a backup file there. The Auto Backup feature is working in there too!

@ghoevil
Copy link
Contributor

ghoevil commented Nov 14, 2022

@keshav-space just test the beta, doesn't work.

img

@keshav-space
Copy link
Owner

@ghoevil, please share the os and version.

@keshav-space
Copy link
Owner

keshav-space commented Nov 14, 2022

Well, what you could do, is maintain a few versions of backups for x days, labeling them with their date then delete the oldest backup while replacing it with the newest. This is good in case the user makes a mistake deleting data and solves the file naming problem above.

The problem I discussed earlier can only be addressed by MANAGE_EXTERNAL_STORAGE permission.
i.e. application can not modify or delete or replace an existing file using create document intent irrespective of which app created it.

v2.0.2-beta has addressed that issue.

@ghoevil
Copy link
Contributor

ghoevil commented Nov 14, 2022

@keshav-space I'm using Huawei P40,and os is Harmony OS 2.0.0.276.

@keshav-space
Copy link
Owner

keshav-space commented Nov 17, 2022

Update

In the last few days, I have extensively read about android's migration towards more privacy-friendly Android APIs.

Below is a brief summary of how that impacts storage access

Android >= 11

No Storage Permission : Apps can create new files in the download folder without permission
Media and File Permission : Apps can read media and files but can't modify or create files except in app-specific storage space [ moreover, the android will never expose the actual file location rather a cached file location is shared with apps]
All File Permission : When MANAGE_EXTERNAL_STORAGE permission is granted, app can read/modify/create/delete files in external shared storage.

Android < 11

No Storage Permission : App can not access any part of external shared storage
File Permission : App can read, modify, create and delete files in external shared storage.

How Safe Notes will handle the storage access?

These access control will become more stringent in the coming year, something similar to iOS, and that's good for user privacy. Bottom line is that apps should not use All file Permission unless absolutely needed.
Safe Notes will not use All File Permission, this means that users will not be able to choose the location of their choice for backup. Backup will be made inside the Download directory within the Safe Notes folder. [See videos below ]

@landry314 This will also resolve the issue you raised here #60, auto backup and manual export is merged.
With fewer nobs and dials, backup looks much simpler and more intuitive.

@ghoevil though I haven't been able to test new feature on Harmony OS I'm sure it will work there too.

The new feature is tested on Android 12, 11, 10, 9, 8.1, 8.0 and 7.1

Android 12 Android 12 Android 11 Android 10
Android_12-API_32-Pixel_4.mp4
Android_12-API_31-Pixel_4.mp4
Android_11-API_30-Pixel_4.mp4
Android_10-API_29-Pixel_4.mp4
Android 9 Android 8.1 Android 8.0 Android 7.1
Android_9-API-28-Pixel-4.mp4
Android_8.1-API_27-Pixel-4.mp4
Android_8-API_26-Pixel_4.mp4
Android_7.1-API_25-Pixel_4.mp4

@ghoevil
Copy link
Contributor

ghoevil commented Nov 19, 2022

@keshav-space yes good, now backup works well on the beta ver. , but the language cannot be clicked with no response.

@landry314
Copy link

landry314 commented Nov 19, 2022

you could also make the backup path:

/storage/emulated/0/Android/data/com.trisven.safenotes/files/Backup/

this makes it harder for the user to find the file but would require no extra permissions i believe.

with an app like Neobackup, all you would need to do is select "External Data" in the backup and it would be added.

@keshav-space
Copy link
Owner

keshav-space commented Nov 19, 2022

but the language cannot be clicked with no response.

The language setting is already added and will be fully functional on the next release i.e. v2.1.0 #86

you could also make the backup path:

/storage/emulated/0/Android/data/com.trisven.safenotes/files/Backup/

  • Users won't be able to easily find the backup file while changing the device.
  • Since that's Safe Notes' app-specific folder user won't be able to couple the backup with other tools like SyncThing

@keshav-space
Copy link
Owner

closing this issue since this was addressed with the new release v2.1.0 https://github.com/keshav-space/safenotes/releases/tag/v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhance existing feature
Projects
None yet
Development

No branches or pull requests

4 participants