Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the possible intent types for intent.setType(type)?

I was searching about how to send an email from my app and I came across this topic:

how to send email from my android app

it solves the problem adding a type to his action send:

i.setType("message/rfc822"); 

That works for me too, I can send my email and it's great. I was just wondering what else I can set there.

I know that if i don't set anything it will show the list with all the options available. I want to force the user to share it using whatever option I pick. Can i explore this to force the user to share in whatever way I desire?

like image 284
caiocpricci2 Avatar asked Oct 25 '12 09:10

caiocpricci2


People also ask

What are the different types of intent?

There are two types of intents in android: implicit and explicit.

What is intent type of intent?

Intent is to perform an action. It is mostly used to start activity, send broadcast receiver, start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents.

What is setType in android?

setType(String mimeType) input param is represent the MIME type data that u want to get in return from firing intent(here myIntent instance). by using one of following MIME type you can force user to pick option which you desire. Please take a Note here, All MIME types in android are in lowercase.

What is intent Action_main?

android. intent. action. MAIN means that this activity is the entry point of the application, i.e. when you launch the application, this activity is created.


2 Answers

I think you aren't supposed to force any kind of behavior when broadcasting a share intent.

i.setType("message/rfc822");  

This sets the MIME type of your intent. I guess, at best, you would have to know which MIME type the app which you intend to use in order to share your content (ex. Facebook) answers, and assure that that app is the only app that will answer your intent.

like image 24
takecare Avatar answered Sep 26 '22 18:09

takecare


This might be so late but as a beginner this is my attempt to your above question :) hope this will help you,myIntent.setType(String mimeType) input param is represent the MIME type data that u want to get in return from firing intent(here myIntent instance).
by using one of following MIME type you can force user to pick option which you desire.
Please take a Note here, All MIME types in android are in lowercase.

Here is the list of common MIME type that you can set in setType():

image/jpeg audio/mpeg4-generic text/html audio/mpeg audio/aac audio/wav audio/ogg audio/midi audio/x-ms-wma video/mp4 video/x-msvideo video/x-ms-wmv image/png image/jpeg image/gif .xml ->text/xml .txt -> text/plain .cfg -> text/plain .csv -> text/plain .conf -> text/plain .rc -> text/plain .htm -> text/html .html -> text/html .pdf -> application/pdf .apk -> application/vnd.android.package-archive 
like image 84
Jameer Mulani Avatar answered Sep 22 '22 18:09

Jameer Mulani