Android Question Downloading files is inconsistent

Carthalion

Member
Licensed User
Longtime User
Downloading files works, but not all files every time. There are 24 downloads. Sometimes it downloads all the files but sometimes only half.

Is there a way to make this more consistent? Only downloading six and a time?

Another idea...is there a way to pre-install these files in DirRootExternal as part of the .apk file?

Also, I tried to use the code editor. Sorry about that. Next time, I hope.

Sub GetFiles
Dim job1 As HttpJob
job1.Initialize("job1", Me)
job1.Download("http://www.mysite.com/" & FolderName & "/textfiles/InetLolo.txt")

Dim job2 As HttpJob
job2.Initialize("job2", Me)
job2.Download("http://www.mysite.com/" & FolderName & "/textfiles/InetLo.txt")

End Sub

Select job.jobName
Case "job1"
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "QQFiles/InetLolo.txt", False)
File.Copy2(job.GetInputStream, out)
out.Close

Case "job2"
Dim out As OutputStream = File.OpenOutput(File.DirRootExternal, "QQFiles/InetLo.txt", False)
File.Copy2(job.GetInputStream, out)
out.Close
End Select
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Please use option where you insert code:

upload_2016-12-10_19-6-55.png
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Look THIS Thread.

Your error is here:

B4X:
File.OpenOutput(File.DirRootExternal, "QQFiles/InetLimits.txt", False)

upload_2016-12-10_19-14-40.png

so i think ( you must try )

B4X:
File.OpenOutput(File.DirRootExternal & "/QQFiles/", "InetLimits.txt", False)
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Anyway for future when you insert new Thread, pls, write more information type: what you see in LOG WINDOWS, etc.
 
Upvote 0

Carthalion

Member
Licensed User
Longtime User
Look THIS Thread.

Your error is here:

B4X:
File.OpenOutput(File.DirRootExternal, "QQFiles/InetLimits.txt", False)

View attachment 50852
so i think ( you must try )

B4X:
File.OpenOutput(File.DirRootExternal & "/QQFiles/", "InetLimits.txt", False)

I did try this and it has too many parameters. I appreciate your response however.

Additionally, I found something that might help explain. When I step through the code, all 24 files are read and then written. Any idea why this would matter? Or any ideas about how to pursue this as a solution?
 
Upvote 0

Carthalion

Member
Licensed User
Longtime User
Now I see where to enter the code. I was trying using the BB Code Editor. Thank you for showing me. (Above)
 
Upvote 0

Carthalion

Member
Licensed User
Longtime User
You can place them in your FILES folder and on appstart copy them to the folder you want (if not already exists)
This does solve my dilemma. I do not know why, but if the files are already there, then they will read and rewrite again every time.
 
Upvote 0
Top