Android App select file with Nextcloud App - File can't be read

I’m developing an Android App and want to support saving and restoring my backups using the nextcloud App.

  1. Backup is working (My own app is saving a zip file. The file can be shared with the nextcloud app and is then uploaded)

  2. 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: Error downloading file:
at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(
at android.content.ContentProviderProxy.openTypedAssetFile(
at android.content.ContentResolver.openTypedAssetFileDescriptor(
at android.content.ContentResolver.openAssetFileDescriptor(
at android.content.ContentResolver.openInputStream(

Hope someone has an idea. Thanks