在Android中打开电子邮件附件
我尝试用我的活动打开特定的电子邮件附件类型,附件本身是一个扩展名为*.os的纯文本windows样式ini文件。在电子邮件中,此文件作为“应用程序/八位字节流”附加。我尝试了以下意图筛选器以捕获活动中的附件:在Android中打开电子邮件附件,android,Android,我尝试用我的活动打开特定的电子邮件附件类型,附件本身是一个扩展名为*.os的纯文本windows样式ini文件。在电子邮件中,此文件作为“应用程序/八位字节流”附加。我尝试了以下意图筛选器以捕获活动中的附件: <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="andro
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" android:host="*" android:pathPattern=".*\\.os"/>
<data android:scheme="https" android:host="*" android:pathPattern=".*\\.os"/>
<data android:scheme="content" android:host="*" android:pathPattern=".*\\.os"/>
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.os"/>
</intent-filter>
电子邮件应用程序正在获取附件,但随后告诉我“附件无法显示”。我能做什么?如何调试它?它应该只是一个文件方案,所以我会删除其他方案并尝试使用它,并将mimeType作为通配符(无论是“*”还是“*/*”):
如果不起作用,可以尝试android.intent.action.MAIN进行操作。检查日志,查看是否提供了与任何内容都不匹配的意图的详细信息。我的解决方案适用于
。wav
文件用于设置mimeType:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="application/os" />
</intent-filter>
是否有一个徽章用于长期未回答的问题?不知道是否有帮助,但有一篇关于如何使用GMail的博文,可能是为您准备的@弗雷德利也一样,因为我认为你需要它是因为额外的赏金;)这将导致一个android.content.IntentFilter$MalformedMimeTypeException:*什么是android:mimeType=“应用程序/os”?
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="application/os" />
</intent-filter>