Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intent Filter to capture all sharing Intents

How can I set my activity to be able to respond to any type of Sharing Intent.

I have tried:-

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="*"/>
</intent-filter>

However this does not work, I have read http://developer.android.com/guide/topics/intents/intents-filters.html but it is not clear how to be that open?

Any help will be much appreciated.

like image 550
baynezy Avatar asked Mar 02 '12 07:03

baynezy


People also ask

What is the purpose of intent filter?

An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component.

Can an activity have multiple intent filters?

To inform the system which implicit intents they can handle, activities, services, and broadcast receivers can have one or more intent filters.

What is the use of intent createChooser () method?

Most commonly, ACTION_SEND action sends URL of build-in Browser app. While sharing the data, Intent call createChooser() method which takes Intent object and specify the title of the chooser dialog. Intent. createChooser() method allows to display the chooser.

What's the difference between intent and intent filters?

An intent is an object that can hold the os or other app activity and its data in uri form.It is started using startActivity(intent-obj).. \n whereas IntentFilter can fetch activity information on os or other app activities.


1 Answers

This is how it is done:-

<intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="application/*" />
    <data android:mimeType="audio/*" />
    <data android:mimeType="image/*" />
    <data android:mimeType="message/*" />
    <data android:mimeType="multipart/*" />
    <data android:mimeType="text/*" />
    <data android:mimeType="video/*" />
</intent-filter>
like image 140
baynezy Avatar answered Nov 15 '22 08:11

baynezy