Replies: 4 comments 1 reply
|
I am also very interested |
0 replies
|
FileKit does not write to the public downloads folder. for that you need MediaStore directly: val values = ContentValues().apply {
put(MediaStore.Downloads.DISPLAY_NAME, "yourfile.pdf")
put(MediaStore.Downloads.MIME_TYPE, "application/pdf")
put(MediaStore.Downloads.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS)
}
val uri = context.contentResolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, values)
uri?.let { context.contentResolver.openOutputStream(it)?.use { out -> out.write(bytes) } }requires API 29+. on older versions you would use |
1 reply
|
got it, makes sense. the MediaStore approach works as a workaround for now but a built-in |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, is there a way to directly save a file into the DIRECTORY_DOWNLOADS folder or more in general in any directory available with the
getExternalStoragePublicDirectorymethod?All reactions