当我尝试触发Intent并且我使用Intent.Action_SEND_MULTIPLE而不是ACTION_SENDTO时,我想要排除Skype,因为我想在启动该电子邮件客户端的情况下附加多个附件。
公共类TestActivity扩展了ActionBarActivity {
Button openEmail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
context = this;
openEmail = (Button) findViewById(R.id.button);
openEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread() {
@Override
public void run() {
//When I use ACTION_SENDTO, this code works fine for me.
Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", "abc@gmail.com", null));
emailIntent.setType("message/rfc822");
emailIntent.putExtra(Intent.EXTRA_SUBJECT,
"EXTRA_SUBJECT");
startActivity(Intent.createChooser(emailIntent,
"Send email..."));
//But when I use the same code just by changing Intent.ACTION_SEND_MULTIPLE, None of the email clients show up.
Intent send = new Intent(Intent.ACTION_SEND_MULTIPLE);
send.setType("message/rfc822");
send.putExtra(Intent.EXTRA_SUBJECT, "EXTRA_SUBJECT");
send.putExtra(Intent.EXTRA_TEXT, "I'm email body.");
send.putExtra(Intent.EXTRA_EMAIL, new String[{"recipient@example.com"});
startActivity(Intent.createChooser(send, "Send mail..."));
}
}.start();
}
});
}
此处一切正常,但如果用户在Android设备中安装了 Skype ,也会显示,我想排除它。
我明白Skype也属于rfc882,它会在启动意图时出现。
有没有解决方法呢? 我经历了很多形式和解决方案,但还没有工作。 很少得到帮助。