2010-06-13 52 views
7

我尝试用我的活动打开特定的电子邮件附件类型,附件本身是纯文本Windows风格的ini文件,其扩展名为* .os。在电子邮件中,这个文件被附加为“application/octet-stream”。我尝试了以下意图过滤赶上我的活动附件:在Android中打开电子邮件附件

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

电子邮件应用程序中获取的附件,但随后告诉我“该附件无法显示”。我能做什么?我怎样才能调试呢?

+0

是否有长期悬而未决的问题徽章? – zehrer 2010-11-04 18:19:10

+0

不知道它是否有帮助,但有关于如何使用GMail做博客的博客,也许有些东西在那里给你? http://carvingcode.blogspot.com/2009/08/how-to-open-gmail-attachments-with.html – DrColossos 2011-01-10 19:11:41

+0

@fredley同样给你,因为我认为你需要它,因为增加的赏金;) – DrColossos 2011-01-10 19:12:35

回答

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的行动。检查日志以查看是否给你提供了与任何内容不匹配的意图的详细信息。

+0

这导致android.content.IntentFilter $ MalformedMimeTypeException:* – zehrer 2011-01-16 13:59:22

0

我的解决办法,这工作了.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> 
+0

什么是** android:mimeType =“application/os”**? – 2017-08-15 21:32:24