'How to handle ScopedStorage and Media File Access
I am too dump to understand what the documentation tells us to use about ScopedStorage. My targetSdk is 31 and I just want to do so simple thing. I want to upload and download Images and Videos, Audio, .pdf files to my backend. I don't want to delete nor edit the files. After I tried so many tutorials, I don't understand clearly about Android's mandantary Scoped Storage from API 30+.
- What permissions are really needed?
- How to handle File access for below Android 10, for Android 10, for Android 10+ ?
- Which scenario can I use for those?
Please help me.
The followings are my usecases. I use Retrofit, Okhttp for remote. I use ActivityResultContracts to get Camera and Gallery's content.
val galleryLauncher =
rememberLauncherForActivityResult(contract = ActivityResultContracts.GetContent()) {
it?.let { uri ->
...
}
}
I got uri but when I get File from that uri and cast to MultipartBody.Part and upload. There is an error (No such file or directory).
Please guide me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
