How to define the MIME type of intent-filter?

Asked by Wei Yang on 2013-03-26

Hi! All,
   I always have this question when I'm writing my own Manifest file. I noted that in the intent filter of ".util.Receive" that the MIME type is defined as "application/note". Is that a widely used MIME type? Normally how do you choose the MIME type when you define Intent filter?

Thanks a lot!

Question information

English Edit question
Tomdroid Edit question
No assignee Edit question
Last query:
Last reply:
Stefan Hammer (j-4) said : #1

Hi! I don't know if application/note is widely used, however, tomboy uses it and therefore we also use it now.
In the beginning I thought that the mimetype of the note files should be text/xml but it was not and everything stopped working if I used this one to receive note files. However, I figured out using the debugging of android that the mime is application/note and afterwards I doublecheckt with the tomboy documentation.
If you want to get some ideas how all this works, you might want to look at the trunk code, and not at some previous versions. I changed a lot recently - not everything should work fine.

What are you up to? ... if I am allowed to ask. Do you have your own app?

Wei Yang (davidyoung8906) said : #2

Hi! Stefan.
Thanks a lot for your answering. I'm actually seeking the software engineering problems in Android development for me to solve in my research. I recently download Tomdroid from F-droid, and the version is 0.7.2. I noticed that it can be triggered by a lot of unrelated intent, and that's why I decided to take a close look at this applications. I'm aware that the most recent code in the trunk will not have such problem. Just wondered why changing to "application/note" will solve the problem, so I asked this question.
Actually, I found that in the development process, it's quite hard for developer to define an appropriate intent filter, because it's hard to predict how intent of other apps will be defined. It's especially true for Category, MIME type. Normally how do you define your intent filter? Just simply based on your apps functionality or like you said to capture the intent that other applications sent?

Thanks a lot!

Stefan Hammer (j-4) said : #3

Hi! I did not only change the mimetype. but did a lot of searching at how to solve this problem.
It seems, that different ways of sharing can access different informations, like file extension, mimetype,...
e.g. in the gmail and mail app, it was possible to klick save and then open with the mimetype text/*, but it was not able to press the "view" button to see the attachment directly. Somehow Android shows a lot of inconsistency here.

further, we had to define two different intent filters: one that opens all text files, text streams and text shares and another one that opens only note files (written in xml).
so the text got the mimetype text/* and the note files application/note.
I did not define the latter myself. Tomboy saves its notes like this, therefore we also use it!
I hope this helps! Good luck for your research :-)

Can you help with this problem?

Provide an answer of your own, or ask Wei Yang for more information if necessary.

To post a message you must log in.