Android download file from url - android

I am developing a simple web browser and faced with a problem. I use DownloadManager to download files from download requests. But I can't download files from GET requests like this: somewebsite.php?t=432513. When I'm trying to download file from such links using DownloadManager I got 1kb file of unknown format. Note, that I can download this file with Chrome or any other browser. Can anyone help me? Thanks in advance.

it's because you are using Query parameter ##somewebsite.php?t=432513## , which return html page not the file. for downloading the file, the URL should have file in it.

Related

.bin File is downloading in flutter webview instead a pdf file

I am downloading a pdf file in webview(flutter_inappwebview),but after downloading i see .bin extension file,The pdf downloading page is locked behind login,so i tried including headers like cookies,userAgents
please solve the my question ?
Govt Website Restrict Download of pdf ,So i finally generated own pdf

m3u file cannot download it from Xtream and implement it in IPTV application

I am working on IPTV player that's going to be implementing a m3u file from Xtream but I don't seem to be able to download the m3u file through Android's DownloadManager and I cannot use it for direct parsing.
I tried downloading the m3u file from the browser and that seems to be going completely fine. But whenever I try to get it from the app itself, it just says download unsuccessful.
The download link to the m3u file is something like this :
http://serverip/get.php?username=customeruser&password=customerpassword&type=m3u&output=mpegts
Is there anything that I can do to parse this? I cannot seem to be downloading it so maybe using libVLC or EXOPlayer I can parse the list directly.
I am relatively new to Android Studio so any help would be appreciated!
EDIT: I tried even downloading a simple .jpg file from the DownloadManager and it seems to be working fine, but downloading m3u files is yet still unsuccessful.
LibVLC can read M3U streams. Try playing your URL in VLC for Android app, if it works, then you can reproduce the same behavior (code is OSS).

ANDROID - How to open a pdf url which does not have a .pdf extension?

I am trying to open a url which is actually a pdf file but it does not have .pdf extension in android webview BUT it does not works. It directly downloads. But when i open the url in WEB browser, the pdf file opens perfectly.
Since this url does not have .pdf extension, I can not use google docs as well. Also tried to download and open the file using any pdf viewer app, it also fails. The main reason is my Url does not have .pdf extension. Is there any other solution?
I think you are not setting the content type as pdf(MIME). Thats why you are getting problem when you are downloading the pdf content.
See this post for more details.
Proper MIME media type for PDF files
MIME TYPES
Render a PDF file using Java on Android
you can see this .pdf extension is not necessary

Android - Download HTML file from URL

I'm building an app which is supposed to download (and later on) display an html file.
I don't need to worry about supporting files like CSS/JS.
I enqueue the file via its URL (eg. http://www.noodle.com/index.html) to the Android Donwload Manager but the download always fails.
Any ideas how to get the file? Or how to convince the Manager to download it properly?
You can make use of HTTPClient provided by Android to use it
More details on how to save that to file is available at
How do I use the Simple HTTP client in Android?

How to get http url of downloaded file in android?

I am trying to find a way to get http-url of downloaded file in android. Is there anyway to do it ?
I have looked around DownloadManager, but it seems not appropriate for this scenario.
e.g. if we open browser with link : http://www.xyz.com/myapp.apk?param1=abc
and now after downloading and installing apk.
In same application (when it starts) I need to get -> param1=abc.
Any kind of help will be appreciated!
Thanks
Personnaly, I think that the downloaded url is not stored in the .apk file. The apk file is a portable file and can be downloaded from different url addresses and the web browser will not add a metadata to the apk file.

Categories

Resources