Currently I'm trying to create a bunch of simple Android apps to replace the default apps with them.
I already saw in this post how to set the SMS app as default:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android-dir/mms-sms" />
</intent-filter>
But I was wondering how to achieve the same for these apps:
I already noticed that it's nearly impossible to set the app as default app programmatically without the user's interaction. This would be the main goal, but it would be also okay if the user can choose which application they want to use as the default application. But I want to be sure that the apps which I listed above are selectable. So my question is, what mime types do I have to add to the intent filters in the android manifest file?
So my question is, what mime types I have to add to the intent filters in the android manifest file?
mimetype
it's just standard of describing content, and it's next processing. This is not something new in Android, you can check more information about Media Types Wiki page. This information about mimetype
attribute in the the Android Documentation:
android:mimeType - A MIME media type, such as image/jpeg or audio/mpeg4-generic. The subtype can be the asterisk wildcard to indicate that any subtype matches
However as you can see the vnd
prefix on a MIME type is a "vendor prefix", meaning that it is not an official IETF MIME type. So you will need to check this type for each application. Just some examples, what we have below.
Note! In order to set default application, you need to specify android.intent.action
first. Because it's main flags between process interaction, so Launcher (for ex.) won't have mimetype
, and only intent actions android.intent.action.MAIN
, android.intent.action.SET_WALLPAPER
.
Camera:
<data android:mimeType="vnd.android.cursor.dir/image" />
<data android:mimeType="vnd.android.cursor.dir/video" />
Image/Video/Audio:
<data android:mimeType="video/*" />
<data android:mimeType="video/mpeg4" />
<data android:mimeType="video/mp4" />
<data android:mimeType="video/3gp" />
......
<data android:mimeType="image/*" />
<data android:mimeType="application/sdp" />
......
<data android:mimeType="audio/x-mpegurl" />
<data android:mimeType="audio/mpegurl" />
<data android:mimeType="application/vnd.apple.mpegurl" />
<data android:mimeType="application/x-mpegurl" />
....
Contacts:
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/person" />
<data android:mimeType="vnd.android.cursor.dir/calls" />
Browser:
<data android:mimeType="application/xhtml+xml"/>
<data android:mimeType="application/vnd.wap.xhtml+xml"/>
<data android:mimeType="vnd.android.cursor.item/postal-address" />
<data android:mimeType="vnd.android.cursor.dir/bookmark"/>
<data android:mimeType="vnd.android.cursor.item/download"/>
You need to register an Intent Filter for the file types, actions, or categories for which you want your app to be the default app. The user will then be able to choose your app as the default app if they want to.
Look here for more information on Intents and Intent Filters.
Forcing your app as the default app for something is only possible with root access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With