I have to download a big file for my app (193MB)
With ftp it takes too long and my log says ' Ignoring event (too many queued events: ftp_downloadprogress).
Download by website is faster and works for me, but not for customers.
They get this error
sub: httpjob_getinputstream (java line: 143)
java.oi.FileNotFoundException: /data/user/0/com.hr.ketels/cache/2 (no such file or directory)
The code that I use is
With ftp it takes too long and my log says ' Ignoring event (too many queued events: ftp_downloadprogress).
Download by website is faster and works for me, but not for customers.
They get this error
sub: httpjob_getinputstream (java line: 143)
java.oi.FileNotFoundException: /data/user/0/com.hr.ketels/cache/2 (no such file or directory)
The code that I use is
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Private link1 As String = "http://visitparijs.nl/appdl/ketels.zip"
End Sub
Sub Globals
Dim ProgressBar1 As ProgressBar
Dim Label1 As Label
Dim btnDownload As Button
' Dim btnCancel As Button
Dim GetFilename As String
Dim Arc As Archiver
Private Buttonback As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
GetFilename = "ketels.zip"
Activity.LoadLayout("1")
End Sub
Sub btnDownload_Click
Dim dd As DownloadData
dd.url = link1
dd.EventName = "dd"
dd.Target = Me
CallSubDelayed2(DownloadService, "StartDownload", dd)
End Sub
Sub dd_Progress(Progress As Long, Total As Long)
ProgressBar1.Progress = Progress / Total * 100
Label1.Text = NumberFormat(Progress / 1024, 0, 0) & "KB / " & _
NumberFormat(Total / 1024, 0, 0) & "KB"
End Sub
Sub dd_Complete(Job As HttpJob)
Log("Job completed: " & Job.Success)
Dim o As OutputStream
o = File.OpenOutput(File.DirDefaultExternal, "ketels.zip", False)
File.Copy2(Job.GetInputStream, o)
o.Close
Job.Release
File.Copy(File.DirDefaultExternal,"ketels.zip", File.DirRootExternal, "HrKetels/ketels.zip")
Arc.Unzip(File.DirRootExternal,"HrKetels/ketels.zip", File.DirRootExternal & "/HrKetels",Null)
Buttonback.Visible = True
End Sub
Sub btnCancel_Click
CallSubDelayed2(DownloadService, "CancelDownload", link1)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Buttonback_Click
Activity.Finish
End Sub