Activity.LoadLayout("Intro")
DBFileDir = rp.GetSafeDirDefaultExternal("") 'File.DirDefaultExternal
If FirstTime Then
If File.Exists(DBFileDir, "helper.db") = False Then
If Msgbox2("About to download the current Database 5.2mb?","Database Download","Yes","","Not Now",Null) = DialogResponse.POSITIVE Then
awake.KeepAlive(True)
ProgressDialogShow2("Please wait",False)
Wait For(downloadDatabase) Complete (Result As Boolean)
ProgressDialogHide
awake.ReleaseKeepAlive
Else
ToastMessageShow("Can't continue without database", True)
ExitApplication
End If
End If
End If
End Sub
Sub downloadDatabase As ResumableSub
Dim j As HttpJob
j.Initialize("", Me)
j.Username = "XXXXXX"
j.Password = "XXXXX"
j.Download("https://www.XXXXX.com/Larastuff/helper.db")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim out As OutputStream = File.OpenOutput(DBFileDir, "helper.db", False)
File.Copy2(j.GetInputStream, out)
out.Close '<------ very important
End If
j.Release
Return True
End Sub