Skip to content Skip to sidebar Skip to footer

How Do I Make My App Appear In App Chooser?

I want to advertise that my app is capable of viewing pdf files so that it will appear in the app chooser when a pdf file is selected from the file manager. Here is what my intent

Solution 1:

You are missing required <category /> tags from your IntentFilter! if you look at the documentation for <category /> it says:

Note: In order to receive implicit intents, you must include the CATEGORY_DEFAULT category in the intent filter. The methods startActivity() and startActivityForResult() treat all intents as if they declared the CATEGORY_DEFAULT category. If you do not declare it in your intent filter, no implicit intents will resolve to your activity.

So you always have to include android.intent.category.DEFAULT as category for the IntentFilter to work at all. If you want you app to be able to handle pdf links from a browser or other apps you also need to include android.intent.category.BROWSABLE. You can find documentation about BROWSABLEhere. It reads:

CATEGORY_BROWSABLE The target activity allows itself to be started by a web browser to display data referenced by a link — such as an image or an e-mail message.

Try this IntentFilter:

<intent-filter><actionandroid:name="android.intent.action.VIEW" /><categoryandroid:name="android.intent.category.BROWSABLE" /><categoryandroid:name="android.intent.category.DEFAULT" /><dataandroid:mimeType="application/pdf" /></intent-filter>

I think you are missing those two categories.

Post a Comment for "How Do I Make My App Appear In App Chooser?"