慢速(Rx)在Android上使用javaMail从Gmail检索附件

时间:2016-04-21 10:30:34

标签: android gmail javamail

我使用JavaMail库访问Gmail,并且在下载压缩文件附件(1 MB)时获得慢速(Rx)性能:

enter image description here

如您所见,获取附件并将​​其写入SD需要大约20秒。

这是我的代码:

$object_story_spec = urlencode($object_story_spec);
$creative = new AdCreative(null, 'ad_Acount_id');
        $creative->setData(array(
            AdCreativeFields::NAME => 'Sample Creative',
            AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
        ));

正在检索邮件:

我试图使用MimeMessage但结果却一样。如果我在Gmail应用程序中下载相同的文件,则需要2秒!发生了什么? Gmail会限制我的带宽吗?难道我做错了什么?谢谢!

编辑:在声明Session对象之前,我已经解决了添加public class MailFile { InputStream is; String fileName; public MailFile( InputStream is, String fileName) { this.is = is; this.fileName = fileName; } public InputStream getIs() { return is; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; }} 的问题。

这是结果Rx:

enter image description here

从20秒开始到2秒难以置信!!

0 个答案:

没有答案