【问题标题】:Opening email attachments in Android在 Android 中打开电子邮件附件
【发布时间】:2010-06-13 09:26:52
【问题描述】:

我尝试使用我的活动打开特定的电子邮件附件类型,附件本身是一个纯文本 windows 样式的 ini 文件,扩展名为 *.os。在电子邮件中,此文件作为“application/octet-stream”附加。我尝试了以下意图过滤器来捕获带有我的活动的附件:

         <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>

电子邮件应用程序正在获取附件,但随后告诉我“无法显示附件”。我能做些什么?我该如何调试?

【问题讨论】:

  • 长期未回答的问题是否有徽章?
  • 不知道它是否有帮助,但有一篇关于如何使用 GMail 进行操作的博文,也许对你有用? carvingcode.blogspot.com/2009/08/…
  • @fredley 对你来说也是一样,因为我认为你需要它是因为增加了赏金;)

标签: android


【解决方案1】:

它应该只是一个文件方案,所以我会删除其他方案并尝试使用它并将 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:scheme="file" />
    <data android:mimeType="*" />
    <data android:pathPattern=".*\\.os" />
    <data android:host="*" />
</intent-filter>

如果这不起作用,可以尝试 android.intent.action.MAIN 来执行该操作。检查日志以查看是否为您提供了与任何内容都不匹配的意图的详细信息。

【讨论】:

  • 这会导致 android.content.IntentFilter$MalformedMimeTypeException: *
【解决方案2】:

适用于 .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>

【讨论】:

  • 什么是 android:mimeType="application/os"
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-04
  • 2021-10-03
  • 1970-01-01
  • 2013-04-08
  • 1970-01-01
相关资源
最近更新 更多