在android中,我有這個URL,我必須做POST請求 返回的輸入流的所述請求返回一個可下載的對象... 我該如何使用Android Downloadmanager本身或自定義創建一個,爲我處理下載過程?Android HTTP POST下載管理器
2
A
回答
0
的Android的下載管理器是相當簡單:
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request(Uri.parse("http://www.theeUrl.fake/image.png"));
enqueue = dm.enqueue(request);
,你可以輕鬆地添加參數爲GET請求。我不知道你是否可以從它發出POST請求。
編輯:做一個POST請求您可以使用HttpClient的是這樣的:
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
HttpResponse response = null;
Dictionary<String, String> postFields = new Dictionary<String, String>();
// Set the post fields
postFields.add("username","toto")));
postFields.add("password", "thePassword45155")));
post.setEntity(new UrlEncodedFormEntity(postFields, HTTP.UTF_8));
// Execute the POST request
response = client.execute(post);
,你應該能夠從獲得的HttpResponse的InputStream要下載的文件。 但您必須自己管理顯示/通知/取消...。
0
http://ootooban.com/en/2012/custom-download-manager-for-android-2-1-part2-resumable-downloads/
創建您自己的通知ontop的POST請求的,具有setProgress組合()&進度的伎倆,所以使用下載管理可悲的是沒有確鑿的方式
+0
鏈接不工作。 – 2017-08-23 06:30:27
相關問題
- 1. Android:下載管理器
- 2. 下載管理器Android:下載完成
- 3. Android的下載管理
- 4. 如何啓動Android下載管理器
- 5. Android的下載管理器限制
- 6. android默認下載管理器
- 7. 完成Android下載管理器
- 8. Android的下載管理器setDestinationInExternalFilesDir
- 9. Android下載管理器保存到/ system
- 10. Android下載管理器PAUSED_WAITING_FOR_NETWORK時間
- 11. 下載管理器概念
- 12. 下載管理器VS InputStream.read()
- 13. 下載管理器無法
- 14. 從下載管理器中隱藏下載android
- 15. 下載文件,下載管理器的Android
- 16. Android的下載管理器說無法打開文件下載
- 17. Android的下載管理器查詢下載
- 18. Android的下載管理器下載位置
- 19. Android通過改進VS下載管理器下載
- 20. 通過Android下載管理器下載大文件
- 21. Android讓下載管理器一次下載一個文件?
- 22. Android的下載管理器保存到下載文件夾
- 23. Android的下載管理器下載完成
- 24. 製作http/https文件共享服務器的Android下載管理器
- 25. Xamarin.iOS下載管理器
- 26. WP下載管理器
- 27. Node.js下載管理器
- 28. 實現下載管理器
- 29. 自定義下載管理器
- 30. Android SDK管理器錯誤下載中斷:意外的HTTP狀態503
什麼是你的目標API? – 2013-03-03 14:10:47
最低支持2.3.6 在4.1平板電腦上開發,但它主要用於2.3.6 – jaggy 2013-03-03 14:14:06
看看這個http://stackoverflow.com/questions/2323617/android-httppost-how-to-get-the-result幫助。 – 2013-03-03 14:20:24