【问题标题】:Open a file with my android App用我的安卓应用打开一个文件
【发布时间】:2013-06-30 01:56:00
【问题描述】:

我正在开发一个应用程序,并且我需要用户能够打开我的应用程序,例如当从 gmail 应用程序、下载文件夹或“文件资源管理器”中单击附件时。

我已经在谷歌上搜索了很多,甚至在 SO 中发现了一些问题,但我无法完成这项工作。

这就是我的 Manifest.xml 文件的样子:

<receiver android:name="MySMS2CloudReceiver"> 
<intent-filter> 
    <action android:name="android.intent.action.ACTION_VIEW" /> 
    <action android:name="android.intent.action.ACTION_EDIT" /> 
    <action android:name="android.intent.action.ACTION_PICK" /> 
    <data android:scheme="http" /> 
    <data android:pathPattern=".*\\.xml" />    
    <data android:host="*" /> 
    <data android:mimeType="application/rss+xml" />
    <data android:mimeType="application/atom+xml" />
    <data android:mimeType="application/xml" />
    <data android:mimeType="text/xml" />
</intent-filter>    
</receiver> 

我的广播接收器:

public class MySMS2CloudReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("MySMS2CloudReceiver", "Leaving onReceived...");
    }
}

但是现在,当我在弹出窗口中单击标题为“使用完成操作”的电子邮件中的附件时,我的应用甚至没有在此处列出...

知道会发生什么吗?

谢谢!!

【问题讨论】:

    标签: android android-intent android-file


    【解决方案1】:

    就我个人而言,我以前没有这样做过,但是你尝试过这个解决方案吗?

    Why isn't my app on the list of apps to open txt file?

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。如果您认为这个问题是重复的,您也可以投票关闭它作为重复。
    猜你喜欢
    • 2015-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 2015-02-08
    • 1970-01-01
    • 1970-01-01
    • 2011-08-30
    相关资源
    最近更新 更多