HTTPUtils SQLite Download

Bill Norris

Active Member
Licensed User
Longtime User
Have been successful with the httputils example that downloads the android icon and sets it as activity background. Next hurdle -- instead of an image, I want to download a sqlite file from the server and copy it to DirDefaultExternal. I am stuck.
 

Bill Norris

Active Member
Licensed User
Longtime User
RE:

So much of that code in the httputils example was very confusing to me, so I was able to figure out just what part I needed to get the file from the server. I put a button on main to start the process. I rem'd out the code that sets the downloaded image to the background so you can see what I did. Added the code you said, but I don't know what to put in after file.copy2
Thanks for you assistance.

B4X:
Sub Button1_Click

        HttpUtils.CallbackActivity = "Main" 'Current activity name.
    HttpUtils.CallbackJobDoneSub = "JobDone"
    HttpUtils.Download("Job1", ImageUrl)

End Sub

Sub JobDone (Job As String)

    If HttpUtils.IsSuccess(ImageUrl) Then 
   
   'Dim b As Bitmap
   'b = HttpUtils.GetBitmap(ImageUrl)
   'Activity.SetBackgroundImage(b)

   Dim filename As String
   filename=HttpUtils.GetInputStream(ImageUrl)
   File.Copy2(what goes here??)

   End If
End Sub
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
RE:

Thank so much, Erel. Got it going now. This is just another step in learning how to setup and implement push notification to update the tablets. Is it possible to use this code to download a file from a local computer rather than a web server?
 
Upvote 0
Top