How to Download and Save File with HttpUtils

Bill Norris

Active Member
Licensed User
Longtime User
When device receives push notice and then downloads a new database, how do we get that new database into storage?

B4X:
Sub get_new_data
   HttpUtils.CallbackActivity = "Main" 'Current activity name.
    HttpUtils.CallbackJobDoneSub = "JobDone"
    HttpUtils.Download("Job1", FileUrl)
End Sub
   
Sub JobDone (Job As String)
   If HttpUtils.IsSuccess(FileUrl) Then 
   ??????????
   
   End If

What goes after

B4X:
If HttpUtils.IsSuccess(FileUrl) Then

to download the file and same it to memory? I have successfully used the push example to download a bitmap and set it as the activity background, like in the demo app, so everything is working properly. Just need to know how to get the file and put it in File.DirDefaultExternal
 
Top