Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim rp As RuntimePermissions
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
wait for Activity_PermissionResult(Permission As String, success As Boolean)
If success Then
Log("Permission is set: "&Permission)
DownloadZip("http://www.intitec.com/actualizaciones/abc.zip")
End If
End Sub
Sub DownloadZip( cZip As String )
Dim j As HttpJob
j.Initialize("", Me)
j.Download( cZip )
Wait For (j) JobDone(j As HttpJob)
If j.Success Then ' It never goes through here !!! Never Success true
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "filename.dat", False)
File.Copy2(j.GetInputStream, out)
out.Close
Log("File saved to "&File.Combine(File.DirRootExternal,"filename.dat"))
Else
ToastMessageShow("Could not download",False)
Log(j.ErrorMessage) ' <--- Error message here.
End If
j.Release
End Sub