Home > Net >  How to send email intent without message?
How to send email intent without message?

Time:09-29

I'm trying to open an email application from my app, without sending any message. I just want to open the app, but when I'm using

val intent = Intent(Intent.ACTION_MAIN)
intent.addCategory(Intent.CATEGORY_APP_EMAIL)
startActivity(intent)

I can't go back to my application. When Gmail app opens, and I press back button, the my application isn't even on the app list. Is there any posibility to open the email app as another application?

CodePudding user response:

this intent will open the Main mail app make sure there is no draft in the mail app and it should work with you

   Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_APP_EMAIL);
    getActivity().startActivity(intent);

CodePudding user response:

If you want to open Email app of sepreate stack

    val intent = Intent(Intent.ACTION_MAIN)
    intent.addCategory(Intent.CATEGORY_APP_EMAIL)
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
    startActivity(intent)
  • Related