Register to be default app for custom file type

You can add the following to the AndroidManifest.xml file inside the activity that has to open the file (pdf in our case)

        <intent-filter >
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="application/pdf" />
        </intent-filter>

Make sure you specify the proper mime format. The user will be prompted to choose your app if she wants to open the “pdf” file.

Check also Android intent filter: associate app with file extension for more details.

Leave a Comment