-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
No support for takePersistableUriPermission? #8336
Comments
Currently I fail to understand what is needed where. Where how do you request what on NC files app? |
Happy to add more detail. One of the features my app offers is regular/automated backups. The workflow is like below:
This is working reliably for Nextcloud and local storage. To simplify the backup process I also allow users to define the destination folder once and then store the uri in sharedPrefs so when the app starts next time, or after a set number of days I can reuse the uri and automatically save another backup in the same folder. To make a uri persistent/survive a restart, I use
This is working, but only if the destination folder is on the local file system. In case the user selected a folder on Nextcloud I can reuse the stored uri for as long as the app is running, the moment the app is restarted the stored uri is invalid, like if the takePersistentUriPermissions call didn't happen. So what I need to find out is, if persistent uri's via contentResolver.takePersistableUriPermission (or any means) are supported by the Nextcloud DocumentsStorageProvider, and if yes, I would like to find out where things go wrong for me. Here's some code to further illustrate:
I do not explicitly use the NC DocumentsStorageProvider but think that when the user selects Nextcloud as destination through the Android file picker UI via the intent, I implicitly interact with it?
Like I said, all of this works for local storage and Nextcloud, it's the persistence which I can't seem to get when the uri points to Nextcloud. Hope this makes more sense now? |
This comment was marked as outdated.
This comment was marked as outdated.
Also looping in @grote, being a user/expert on SAF/document-provider and utilizing the Nextcloud files app for interactions |
Seedvault is using |
Great! Thanks for confirming that |
Well, after checking the Thanks everyone for helping me along to get to this successful conclusion! |
Thanks to your help here #8028 I managed to sucessfully implement backups to NextCloud. However, there is one thing where I don't know if it is by design or a bug.
When creating a backup I capture the URI and request persistent permissions so I can backup user data automatically when the app is started again:
app.contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
This works fine as long as the destination is local. If I pick Nextcloud as a target I can reuse the uri for backups as long as the app is running. The moment the app is restarted the uri is invalid. So to me this looks like the takePersistableUriPermission call isn't working or maybe simply not supported for Nextcloud?
Steps to reproduce
or
Expected behaviour
Actual behaviour
Environment data
Android version: 10
Device model: Several
Stock or customized system: Stock
Nextcloud app version: 3.15.1
The text was updated successfully, but these errors were encountered: