I want to find email client installed on device and redirect email id on that application to send email message. It working fine below on android 10, but it not working in android 11. I found article regarding Package visibility filtering on Android 11. I didn't understand how to achieve this code functionality in android 11
request?.url.toString().startsWith("mailto:") -> {
val intent = Intent(Intent.ACTION_SENDTO)
intent.type = "message/rfc822"
intent.data = Uri.parse(request?.url.toString())
view?.context?.packageManager?.let { packageManager ->
if (packageManager.resolveActivity(intent, 0) != null) {
view.context?.startActivity(intent)
} else {
Log.E("Error to find ", "Email client")
}
}
}
It launch email client on lower than android 10 but unable to find email client in android 11. It shows always Error to find Email client. Can someone explain me in more detail how Package visibility filtering on Android 11 is working and can someone share some piece of code how to achieve this.