Messaging and email intents in Android?

后端 未结 2 1664
闹比i
闹比i 2021-01-23 13:01

I\'ve searched Google for this, but have only found similar examples--not exactly what I need. I simply need to start messaging (SMS) and email intents from my app with their \"

相关标签:
2条回答
  • 2021-01-23 13:16

    For the e-mail part :

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"foo@bar.com"});
    
    emailIntent.setType("text/plain");
    startActivity(Intent.createChooser(emailIntent, "Send a mail ..."));
    
    0 讨论(0)
  • 2021-01-23 13:18

    from Only Email apps to resolve an Intent

       String recepientEmail = ""; // either set to destination email or leave empty
       Intent intent = new Intent(Intent.ACTION_SENDTO);
       intent.setData(Uri.parse("mailto:" + recepientEmail));
       startActivity(intent);
    

    will filter out all non-email applications.

    0 讨论(0)
提交回复
热议问题