Private Sub BtnUpdate_Click
If Application.VersionCode = latestVersion Then
xui.MsgboxAsync("You already have the latest version", "")
Return
End If
If File.Exists(File.DirInternal, FileToInstall) = False Then
'File.Copy(File.DirAssets, FileToInstall, File.DirInternal, FileToInstall)
Log("Downloading updates from remote server...")
Dim job As HttpJob
job.Initialize("", Me)
job.Download("https://acme.com/files/2.apk") ' file uploaded to your server
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirInternal, FileToInstall, False)
File.Copy2(job.GetInputStream, out)
out.Close '<------ very important
Log("Download complete")
Else
Log("Error: " & job.ErrorMessage)
End If
job.Release
End If
SendInstallIntent
End Sub