I’m taking a picture with the camera and saving it. In Android Q and above, I use the
context.contentResolver.insert function to get a content
Uri and for Android versions below Q, I create the file on disk and then use
FileProvider to get the
Uri. In both cases, I pass that
Uri as the
MediaStore.EXTRA_OUTPUT of the
MediaStore.ACTION_IMAGE_CAPTURE intent and that
Uri is also what I save in my database.
If later, I want to delete the picture, how am I supposed to do that by
Uri? In StackOverflow, everyone is doing it in a different manner and at this point, I don’t know what works and what not and for which Android versions.