Mandroid Mandroid - 9 months ago 38
Android Question

How to make app appear as an option application?

What needs to be done to make your app appear as an option app.
For eg, when I select an image file, android shows me a list of applications to open the file with, like Gallery,Photos etc.
I want that android also shows my app in this list.

How to achieve this? I am unable to understand which android classes to use for it? Or do I need to modify manifest file to add some specific intents?

Answer Source

By defining intent filter you can achieve this. You can register your Android components via intent filters for certain events.If a component does not define one, it can only be called by explicit intents. The key for this registration is that your component registers for the correct action, mime-type and specifies the correct meta-data.


<activity android:name=".BrowserActivitiy"
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <data android:scheme="http"/>

Above code will register an Activity for the Intent which is triggered when someone wants to open a webpage.