codelab-android-workmanager
codelab-android-workmanager copied to clipboard
Use of MediaStore in SaveImageToFileWorker.kt throws an exception
In SaveImageToFileWorker.kt the code line
val imageUrl = MediaStore.Images.Media.insertImage(
resolver, bitmap, Title, dateFormatter.format(Date()))
throws an exception; hence no image is stored and no output is produced. As a result in BlurActivity the final check to activate the seeFileButton using the code
// If there is an output file show "See File" button
if (!outputImageUri.isNullOrEmpty()) {
viewModel.setOutputUri(outputImageUri as String)
binding.seeFileButton.visibility = View.VISIBLE
}
always fails
This may be related to issue 259
PS I am using android studio 2020.3.1 to compile and run
Please check if you have given storage permission.