Remove the "Select conversation" dialog for receiving android.intent.action.SEND

Viewed 33

I'm receiving plain text through android.intent.action.SEND. Everything works but sometimes Android shows a dialog that I don't want. It has something to do with Direct Share Targets. But I'm not using those and the app doesn't even have conversations. How do I get rid of it?

<activity android:name=".Activities.ShareActivity">
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="text/plain" />
    </intent-filter>
</activity>


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_share);

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
            if (sharedText != null) {
                ((TextView)findViewById(R.id.textView)).setText(sharedText);
            }
        }
    }

enter image description here

0 Answers
Related