Android Question Apk is parsing error downloading from some website

teddybear

Well-Known Member
Licensed User
I would like to self upgrade app from website, and use the example to do that.

the following code only modified File.Copy to j.Download
B4X:
    Dim j As HttpJob
    j.Initialize("j", Me)
     ' noted code works well'
    'j.Download("https://newsoftdown01.rbread05.cn/down/2021down/11/11/dianshijiachangxianban.apk")
    'the link does't work
    j.Download("https://github.com/cnteddybear/Json/blob/main/1.apk")
    
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Dim out As OutputStream = File.OpenOutput(Starter.Provider.SharedFolder, ApkName, False)
        File.Copy2(j.GetInputStream, out)
        out.Close '<------ very important
        Log(Starter.Provider.SharedFolder)
        
        Else
        Log("Error: " & j.ErrorMessage)
    End If
    j.Release
    Log("apk="&File.Size(Starter.Provider.SharedFolder,ApkName))
    'File.Copy (File.DirAssets,"1.apk", Starter.Provider.SharedFolder,ApkName)
Noted line is ok
Github doesn't work, the downloading stream seems to be zipped?
but browser downloads the apk, copy it to phone and install ok.
 
Last edited:

teddybear

Well-Known Member
Licensed User
Please close the thread, downloading the apk I have to login into the website.
 
Upvote 0
Top