Only Email apps to resolve an Intent

后端 未结 14 1539
执念已碎
执念已碎 2020-12-03 06:30

I have a problem .. I want only email activities to resolve intent ACTION.SEND but beside email I get other apps as well (e.g TubeMate) even though I have set the mime type

相关标签:
14条回答
  • 2020-12-03 07:35

    In Android, there's no such thing as an email activity. There's also no intent filter that can be created to include only email applications. Each application (or activity) can define its own intent filters.

    So when using intent ACTION_SEND, you'll have to rely on the users intelligence to pickhis favorite email app from the chooser (and not TubeMate).

    0 讨论(0)
  • 2020-12-03 07:35

    When I use intent android.content.Intent.ACTION_SENDTO doesn't work for me because it shows many apps, some apps are not email clients. I found this way and it works perfectly for me.

    Intent testIntent = new Intent(Intent.ACTION_VIEW);  
    Uri data = Uri.parse("mailto:?subject=" + "blah blah subject" + "&body=" + "blah blah body" + "&to=" + "sendme@me.com");  
    testIntent.setData(data);  
    startActivity(testIntent);
    
    0 讨论(0)
提交回复
热议问题