Android的下载管理器和SSL(HTTPS) [英] Android DownloadManager and SSL (https)

查看:1893
本文介绍了Android的下载管理器和SSL(HTTPS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哦,太棒了。总有别的东西,一些......哎呀......

反正,所以我的工作好多天通过模糊的,不完整的,相互矛盾的Picasa的信息,涉水,使我的Andr​​oid应用程序能找到一个Picasa的图片,并使用下载管理器下载。所以,刚才我做了收尾并点击运行按钮。一切都很好,直到下载管理器试图下载文件:

  java.lang.IllegalArgumentException:如果只能下载HTTP的URI:https://example.com/image.jpg
 

告诉我你是在开玩笑。告诉我他们没有一个下载管理器无法处理SSL ......

更重要的是,告诉我如何打开在Android的下载管理器的SSL连接。

解决方案

我有同样的问题previously

。是啊我看到HTTPS支持已经在ICS,但不是在2.3.7及以下,但是我们可以提取源$ C ​​$ C创建一个下载管理器来支持这一点。

基于从样品code

http://android-er.blogspot.com/2011/07/sample-$c$c-using-androidappdownloadman.html 我做了一个演示用提取的下载管理器以支持HTTPS。

您可以找到样本code在这里 https://github.com/ alvinsj / Android的-HTTPS的下载管理器,演示,仅通过更改URL到您的基于HTTPS的URL运行。

Oh, great. There's always something else that some... Grrr...

Anyway, so I worked days and days wading through vague, incomplete, and contradictory Picasa information so that my Android app could find a Picasa picture and download it using the download manager. So just now I made the finishing touches and hit the "run" button. Everything went fine until DownloadManager tried to download the file:

java.lang.IllegalArgumentException: Can only download HTTP URIs: https://example.com/image.jpg

Tell me you're joking. Tell me they didn't make a download manager that can't handle SSL...

Better yet, tell me how to turn on SSL access in the Android download manager.

解决方案

I had the same problem previously. Yup I see HTTPS support is already in ICS, but not in 2.3.7 and below, but we can extract the source code to create a DownloadManager to support that.

Based on the sample code from http://android-er.blogspot.com/2011/07/sample-code-using-androidappdownloadman.html i made a demo with extracted DownloadManager to support HTTPS.

You can find the sample code here https://github.com/alvinsj/android-https-downloadmanager-demo, run by just changing the url to your https based url.

这篇关于Android的下载管理器和SSL(HTTPS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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