I'm using this code to open email chooser via intent
val mIntent = Intent(
Intent.ACTION_SENDTO, Uri.fromParts(
"mailto",
"name@email.com", null
)
)
mIntent.putExtra(Intent.EXTRA_SUBJECT, "[Feedback - App Name]")
mIntent.putExtra(Intent.EXTRA_TEXT, "")
try {
startActivity(Intent.createChooser(mIntent, "Choose Email Client..."))
} catch (e: Exception) {
(activity as MainActivity).showToast("There are no email clients installed.")
}
it works as expected but it also includes PayPal app in the list of email clients.
On clicking PayPal, if the email is registered with PayPal, it redirects to the payment page. And if not registered, it shows below screen.
In both scenarios, there is no option to send emails from the PayPal app.
So, How can I include only email clients in the intent chooser?
I have tried this code as well, it also results in the same.
val intent = Intent(Intent.ACTION_SENDTO)
intent.data = Uri.parse("mailto:")
intent.putExtra(Intent.EXTRA_EMAIL, "addresses")
intent.putExtra(Intent.EXTRA_SUBJECT, "subject")
if (intent.resolveActivity(activity?.getPackageManager()!!) != null) {
startActivity(Intent.createChooser(intent, "Choose Email Client..."))
}
EDIT :
I have checked in other apps where the same dialog is opening. May be PayPal app is listening to mail events.