Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
How to set apps as default or let the user select the app?

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:

  • Camera application (To take pictures)
  • Gallery/Photo application (To select and view images)
  • Contact application (To view, edit, delete and call contacts)
  • Telephone application (To call contacts/telephone numbers and receive incoming calls)
  • Internet browser application (To browse the internet)
  • Keyboard application (To write text like in the default keyboard)
  • Launcher application (To display all installed apps on the home screen)

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?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

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"/>
over 4 years ago · Santiago Trujillo Relatório

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

I am not sure but using Intent.createChooser() you will get the solution click here

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda