Open Beatis opened 4 years ago
My problem exactly,my head hurts.lol.Did u find the solution?
My problem exactly,my head hurts.lol.Did u find the solution?
I just save file manually with this code.
fun handleActivityResult(requestCode: Int, resultCode: Int, data: Intent?, func: (bitmap: Bitmap) -> Unit) {
imageManager.handleActivityResult(
requestCode,
resultCode,
data,
context as Activity,
object : DefaultCallback() {
override fun onMediaFilesPicked(imageFiles: Array<MediaFile>, source: MediaSource) {
imageFiles[0].also {
savePublicImage(it.file)
}
}
})
}
private fun savePublicImage(file: File) {
val values = ContentValues()
values.put(MediaStore.Images.Media.TITLE, context.getString(R.string.app_name))
values.put(MediaStore.Images.Media.MIME_TYPE, "image/*")
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
values.put(
MediaStore.Images.Media.RELATIVE_PATH,
"DCIM/${context.getString(R.string.app_name)}"
)
}
val item =
context.contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
item?.let { uri ->
context.contentResolver.openFileDescriptor(uri, "w", null).use { pfd ->
pfd?.let {
val output = FileOutputStream(it.fileDescriptor)
output.write(file.readBytes())
output.close()
}
}
}
}
Thank you but i don't know how to code in Kotlin
I would like to ask, will you upgrade your library for new API where we dont have access to save our images in public storage, like it happens now, instead we have to use temporary files for saving data about captured images and write it into MediaStore?