Excluding the mime type from Android manifest file

回眸只為那壹抹淺笑 提交于 2019-12-22 14:59:31

问题


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="*/*" />

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.

cheers, Saurav


回答1:


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>

...regarding to http://www.iana.org/assignments/media-types/media-types.xhtml there are just those few mime-groups available.



来源:https://stackoverflow.com/questions/20945600/excluding-the-mime-type-from-android-manifest-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!