Hi,
I’m developing an Android App and want to support saving and restoring my backups using the nextcloud App.
-
Backup is working (My own app is saving a zip file. The file can be shared with the nextcloud app and is then uploaded)
-
Restore is not working yet. I’m sending an ACTION_GET_CONTENT intent and select the file from Nextcloud. The problem is that I can’t find a way to read the selected file. I tried different ways and even the one that worked from many different locations and apps is crashing. At least I can differentiate when the file was selected using nextcloud (uri authoritity org.nextcloud.documents)
val inputStream = context.contentResolver.openInputStream(uri) //uri returned from ACTION_GET_CONTENT by Nextcloud app
It always fails with FileNotFoundException:
Caused by: java.io.FileNotFoundException: Error downloading file: batteryManager2017_12_24_15_33_25.zip
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149)
at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1687)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1503)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1187)
Hope someone has an idea. Thanks