Android Question (B4A) Error Unable to resolve host, but on my phone work!

Sabotto

Well-Known Member
Licensed User
An app of mine that downloads a file from a site, works fine on my smartphone, (Huawei P20) while giving error on a friend's (Note 10)
The instruction that fails on his smartphone is this

B4X:
        Dim j As HttpJob
        Dim Sito As String = "https://www.miosito.it/MiaDir"
        Dim SitoFile As String
        
        j.Initialize("", Me)
        
        SitoFile = File.Combine(Sito, "miofile.txt")
        j.Download(SitoFile)    ' <============= error
        Wait For (j) JobDone(j As HttpJob)
        If j.Success Then
            Dim out As OutputStream = File.OpenOutput(DirDestination, "miofile.txt", False)
            File.Copy2(j.GetInputStream, out)
            out.Close '<------ very important
            Result1=1
        End If

and this is the log
ResponseError. Reason: java.net.UnknownHostException: Unable to resolve host "www.miosito.it": No address associated with hostname, Response:

What could it be, considering that everything works on another smartphone?
 

josejad

Expert
Licensed User
Longtime User
Probably the error is not in your app but in your server. Try to get the file from an explorer.
I get an error too, "file not found",

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Is your server in a local network?
 
Upvote 0

Sabotto

Well-Known Member
Licensed User
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
miosito.it is a real site
 
Upvote 0
Top