Android Question How call DownloadAndSave?

SergeNova

Member
Hello everyone, here is my first post here. I want to know about DownloadAndSave from Erel, is this Sub <<DownloadAndSave>> is called automatically when the user wants to download a file? Thank you, your help will be appreciated


Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Url)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
File.Copy2(j.GetInputStream, out)
out.Close
End If
j.Release
Return j.Success
End Sub
 

AnandGupta

Well-Known Member
Licensed User
Longtime User
Hi Serge Nova

You may check my B4XGoodies Check App

It has codes using the DownloadAndSave code.

Regards,

Anand
 
Upvote 0

SergeNova

Member
My problem is not to download a file from web page but to target the file to download. if there is a way to call Download automatically when you click on a file on a web page, then your proposal will help me a lot. Thank you
 
Upvote 0

AnandGupta

Well-Known Member
Licensed User
Longtime User
Hi Serge

You can use WebView1_OverrideUrl to get url of file clicked in webpage in your webview.
Then you can download the url file as required.

Regards,

Anand
 
Upvote 0
Top