I implemented sending email feature on my app like this:
val emailIntent = Intent(Intent.ACTION_SENDTO)
emailIntent.type = "message/rfc822"
emailIntent.putExtra(Intent.EXTRA_EMAIL, arrayOf("myId@gmail.com"))
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Hello~")
emailIntent.putExtra(Intent.EXTRA_TEXT, "$sendData")
try {
startActivityForResult(Intent.createChooser(emailIntent, "Send mail..."), RESULT_SEND_EMAIL)
} catch (ex: ActivityNotFoundException) {
Toast.makeText(this@MyActivity, "There are no email clients installed.", Toast.LENGTH_SHORT).show()
} catch (e : Exception){
Toast.makeText(this@MyActivity, "${e.toString()}", Toast.LENGTH_SHORT).show()
}
I used startActivityForResult()
for the process after coming back from the intent.
And the problem is Gmail app doesn't open on one of my coworker's device. She uses Huawei mate pro. It still shows up on the app chooser menu. But just can't open.
What's wrong with this? Is it my problem or Gmail problem or the device problem?