给G下载附件/电子邮件的Andr​​oid [英] Downloading attachment from g/email in Android

查看:174
本文介绍了给G下载附件/电子邮件的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从电子邮件下载自定义文件到我的应用程序。我用下面由理查德·莱格特所建议的意图过滤器。该应用程序在Eclipse VM工作正常,并下载该文件,但在Nexus 7(奇巧)或宏碁(ICS)平板电脑在安装时将无法正常工作。查看按钮显示出来在虚拟机而不是在真正的平板电脑电子邮件附件。任何想法将AP preciated。

 < /意向滤光器>
            <作用机器人:名字=android.intent.action.VIEW/>
            <类机器人:名字=android.intent.category.DEFAULT/>
            <数据
                机器人:主机=*
                机器人:mime类型=应用/ FDH
                。* \\\\ FDH:机器人pathPattern = />
        &所述; /意图滤光器>
        &所述;意图滤光器>
            <作用机器人:名字=android.intent.action.VIEW/>            <类机器人:名字=android.intent.category.DEFAULT/>            <数据
                机器人:主机=*
                机器人:mime类型=应用程序/八位字节流
                。* \\\\ FDH:机器人pathPattern = />
        &所述; /意图滤光器>

从@Sergey帮助解决它。我的自定义文件实际上是XML格式的,所以我现在保存为XML文件,并使用此: -                 

 <类机器人:名字=android.intent.category.DEFAULT/>            <数据
                机器人:主机=com.mydomain.myapp
                机器人:mime类型=文/ XML
                *。xml的\\\\:机器人pathPattern = />
        &所述; /意图滤光器>


解决方案

Gmail没有让你点击网址的未知的计划,这样你就可以使用以http://开头的模式。
要定义清单中做这样的事情:

 <意向滤光器>
    <作用机器人:名字=android.intent.action.VIEW/>
    <类机器人:名字=android.intent.category.DEFAULT/>
    <类机器人:名字=android.intent.category.BROWSABLE/>
    <数据机器人:计划=HTTP机器人:主机=com.yourdomain.yourapp/>
&所述; /意图滤光器>

I want to download custom files from email to my app. I used intent filters below as suggested by Richard Legget. The app works fine in the Eclipse VM and downloads the file, but won't work when installed on Nexus 7 (Kit Kat) or Acer (ICS) tablets. The View button shows up on the email attachment in the VM but not on the real tablets. Any ideas would be appreciated.

        </intent-filter>  
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data
                android:host="*"
                android:mimeType="application/fdh"
                android:pathPattern=".*\\.fdh" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="*"
                android:mimeType="application/octet-stream"
                android:pathPattern=".*\\.fdh" />
        </intent-filter> 

Solved it with help from @Sergey. My custom file is in fact XML format so I now save as an xml file and use this:-

            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="com.mydomain.myapp"
                android:mimeType="text/xml"
                android:pathPattern=".*\\.xml" />
        </intent-filter>   

解决方案

GMail doesn't let you click URL's with unknown schemes, so you can use the schema that beginning with "http://". To define in manifest do something like this:

<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="com.yourdomain.yourapp"/>
</intent-filter>

这篇关于给G下载附件/电子邮件的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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