从Android清单文件中排除MIME类型 [英] Excluding the mime type from Android manifest file
问题描述
我通过将这段代码放在androidmainfest.xml中来使用android共享功能
I am using android sharing functionality by putting this code in androidmainfest.xml
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
当前在我的应用程序中,我不支持纯文本/文本"的处理.否则,我支持所有其他类型的mime类型.有什么办法可以在manifest.xml中提及我不想从处理中排除的类型,而不是提及我处理过的所有类型.
In my application currently i do not support handling of "plain/text". Otherwise i support all other kind of mime types. is there any way i can mention the type in the manifest.xml which i wan't to exclude from handling rather than mentioning all the types which i handle.
欢呼声, 索拉夫(Saurav)
cheers, Saurav
推荐答案
对于将像文本/纯文本"这样的模仿类型列入黑名单,可能有更好的解决方案.在我的应用程序中,我还接受所有文件(出于存储目的),但不想仅接收dropbox文件的链接或其他任何内容(以文本/纯文本形式发送).
Propably there is a better solution for blacklisting mimetypes like "text/plain". In my app I also accept all files (for storage purpose) but don't want to receive just Links of dropbox-files or whatever (who are sent as text/plain).
也许使用白名单并完全禁止显示文本文件:
Maybe use a whitelist and suppress textfiles at all:
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="model/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="video/*" />
</action>
...关于 http://www.iana.org/assignments/media-types/media-types.xhtml 仅有少数几个mime-groups可用.
...regarding to http://www.iana.org/assignments/media-types/media-types.xhtml there are just those few mime-groups available.
这篇关于从Android清单文件中排除MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!