Android DownloadManager with POST method?


I started working with android.app.DownloadManager and ran into a problem.
By default, the DM sends an HTTP GET request to download the file:

GET http://www.example.com/getfile HTTP / 1.1
Cookie: id = sdfsdf; Max-Age = 10,800,000; Path = /
Host: ___
Connection: Keep-Alive
User-Agent: AndroidDownloadManager Paros / 3.2.13
Content Length: 0

But I need to send some data to the request (e.g. json string)
Is there a way to send an HTTP POST request to the DownloadManager

+6
source share
1 answer

Expecting an even more accurate answer:

I don’t think you can add data to this request, because, as you said, this is a GET request, not a POST .

Maybe this thread can give you a hint of another way to achieve what you want if Download-Manager not absolutely necessary: How to upload a file with a username using HttpURLConnection

+3
source

Source: https://habr.com/ru/post/919059/


All Articles