sandalone
sandalone

Reputation: 41749

ACTION_SEND: Possible to filter applications which accept attachments?

I am trying to share text and attachment using ACTION_SEND.

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"email"});
    intent.putExtra(Intent.EXTRA_SUBJECT, "subject");
    intent.putExtra(Intent.EXTRA_TEXT, "body");

    Uri uri = Uri.fromFile(file);
    intent.putExtra(Intent.EXTRA_STREAM, uri);

    startActivity(Intent.createChooser(intent, "Send..."));

However, in the list appear applications like Hangouts which do not accept attachments.

Can I filter out application which do not accept attachments? Is there a tag or another indicator which can tell me if application accepts attachments or not?

Upvotes: 0

Views: 195

Answers (1)

deepak825
deepak825

Reputation: 432

  intent.setType("message/rfc822");

Use this.

Upvotes: 1

Related Questions