Home > Net >  Android email intent without message
Android email intent without message

Time:09-22

I'm trying to open email application, but without sending Email, I just want to open 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. After Gmail app open, when I press back button, the application isn't even on app list. Is there any posibility to open email app as anothen 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