Android Question Problem downloading apk file from server using httpjob

borofan

Member
Licensed User
Longtime User
I can't download a full .apk file from my server. It only downloads 3kb of data, when the actual apk is around 1500kb, no errors are displayed until I try installing.
It's definitely the correct URL and if I navigate to the URL using the browser it downloads fine on the device.
Am I missing anything? Is there a better way to achieve this?

Many thanks in advance.

B4X:
Dim job_22 As HttpJob
job_22.Initialize("job_22",Me)
Dim apkurl As String = "http://myserver.com/appname.apk"
job_22.Download(apkurl)

Wait for JobDone (job_22 As HttpJob)
If job_22.Success = True Then
    'delete if exists
    If File.Exists(File.DirRootExternal,"appname.apk") = True Then
        File.Delete(File.DirRootExternal,"appname.apk")
    End If
    'save to dir.
    Dim out22 As OutputStream = File.OpenOutput(File.DirRootExternal,"appname.apk", False)
    File.Copy2(job_22.GetInputStream, out22)
    out22.Close
End If
job_22.Release
 
Last edited:

borofan

Member
Licensed User
Longtime User
Thanks Erel. Looks like it was intercepting another request.

As soon as I updated my code to include the sender filter it worked:

B4X:
Wait for (job_22) JobDone (job_22 As HttpJob)
 
Upvote 0
Top