android-image-picker
android-image-picker copied to clipboard
Camera image not saved
Expected Behavior
Captured image exists
Actual Behavior
Captured image doesn't exist
Steps to Reproduce the Problem
- Create a launcher
launcher = registerImagePicker { result ->
if (result.isNotEmpty()) {
val exists = File(result.first().path).exists()
}
}
- Call the launcher
launcher.launch(CameraOnlyConfig())
The file returned as result doesn't exist. In Logcat I find:
MediaScannerConnection D Scanned /storage/emulated/0/Android/data/packagename/files/Pictures/Camera/IMG_20230220_184510_996.jpg to null
ImagePicker D File /storage/emulated/0/Android/data/packagename/files/Pictures/Camera/IMG_20230220_184510_996.jpg was scanned successfully: null
ImagePicker D scanFile is failed. Uri is null
Specifications
- Image Picker Version: 3.0.0
- Android OS: Android 12
- Phone: Samsung S22
My friend, I found a workaround but is not the best solution.
Just replace the path manually with this
var finalPath = if (File(image.path).exists()) image.path else image.path.replaceBefore("/I", "/storage/emulated/0/Pictures")
I have same issue. The image always saved on /storage/emulated/0/Pictures
folder. The option savePath
is not working. It's still return in the result but it's doesn't saved.
It's seem to be a bug.