我如何确保电子邮件应用程序会用我的应用程序打开一个文件? [英] How do I ensure that the email app will use my app to open a file?

查看:199
本文介绍了我如何确保电子邮件应用程序会用我的应用程序打开一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在建立一个应用程序,允许你使用电子邮件的电子邮件和出口创造了那些加载文件。该扩展.lq。我目前正在使用这个意图过滤器,但是我一再得到错误无法显示此附件中的标准电子邮件应用程序试图打开扩展名为.lq东西的时候:

I'm currently building an app that allows you to load files from emails and export created ones using email. The extension is .lq. I am currently using this intent filter however I repeatedly get the error 'This attachment cannot be displayed' in the standard email app when attempting to open something with the extension .lq:

<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=".*\\.lq"/>
    <data android:host="*"/>
</intent-filter>

我已经尝试了一些不同的解决方案,但是他们都没有工作过。

I've tried a number of different solutions however none of them have worked.

推荐答案

您可以使用的意图拦截应用程序来分析您的邮件应用发送的意图和知道你需要创造什么样的意图过滤器。

You can use the Intent Intercept application to analyse the Intent sent by your mail app and know what intent filter you need to create.

从Gmail应用程序,我得到以下意图:

From the gmail app, i get the following intent :

动作:android.intent.action.VIEW

Action : android.intent.action.VIEW

数据:内容://gmail-ls/myemail@gmail.com/messages/471/attachements/0.1/BEST/false

Data : content://gmail-ls/myemail@gmail.com/messages/471/attachements/0.1/BEST/false

URI:内容://gmail-ls/myemail@gmail.com/messages/471/attachements/0.1/BEST/false

URI : content://gmail-ls/myemail@gmail.com/messages/471/attachements/0.1/BEST/false

类型:image / PNG

Type : image/png

所以,问题是,你的.lq不是标准的扩展,你可以不依赖于文件名或者与.lq结束,因为它使用的内部名称不带扩展名。

So the problem is that your .lq is not a standard extension, and you can't rely on the file name to end with .lq either, as it uses an internal name without extension.

您可以使用一个意图过滤器捕捉的内容:// *的URI。

You could use an intent filter to catch content://* URIs.

这篇关于我如何确保电子邮件应用程序会用我的应用程序打开一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆