On Android 10 and below, when I take a picture using the code below, everything is fine except for Android 11 and above.
private fun openCameraApp() {
val photoURI: Uri = FileProvider.getUriForFile(
this,
"com.example.android.fileprovider",
appFolder
)
refresh()
val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI)
println("::Camera result:: ${photoURI}")
resultLauncher.launch(cameraIntent)
}
Since API
level 30 (Android 11), there have been changes in the package visibility.For your package manager to work properly, you need to declare
<queries>in yourAndroidmanifest.xmlfileCode.
This will only be worked for android default camera apps
Happy Coding :)