我想用我的应用程序打开电子邮件中的音频附件。目前我的 Intent 过滤器是这样的:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/wav" />
<data android:scheme="http" android:host="*" android:pathPattern=".*\\.wav"/>
<data android:scheme="https" android:host="*" android:pathPattern=".*\\.wav"/>
<data android:scheme="content" android:host="*" android:pathPattern=".*\\.wav"/>
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.wav"/>
</intent-filter>
这适用于我想要的所有内容,除了电子邮件附件。目前,如果我收到一个 wav 文件,我唯一能做的就是预览它,然后用 Winamp 打开(很明显,第 3 方应用程序可以进入)。不过,我找不到应该添加的内容来执行此操作,有人知道吗?
编辑
这是 LogCat 对此事的看法。当我点击预览时,我得到了
01-10 19:28:52.691: INFO/ActivityManager(109): Starting: Intent { dat=content://gmail-ls/messages/xxxxxxx%40gmail.com/439/attachments/0.1/BEST/false cmp=com.google.android.gm/.ViewAttachmentActivity } from pid 19483
奇怪的是,Winamp 会自动打开,并且没有设置为默认值。我别无选择...
最佳答案
将 audio/wav
替换为 audio/*
使其工作,但这显然是不受欢迎的行为。
关于android - 电子邮件附件的 Intent 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4649969/