Android Question FYI - Android 7 / API 24 Download fails

Robert Valentino

Well-Known Member
Licensed User
Longtime User
In reference to this posting:wait for internet

Just my 2cents - I found (from working with a user [over the last 2 days] that has a device with Android 7 API 24) that this code will fail.

For some reason Android 7 doesn't seem to like secure website?
Maybe not Android 7 directly but this is only device I know having this problem

"https://www.google.com/" what I do is if this failed then I try the same download without the "s"
"http://www.google.com/" and if that works then all is good

pseudo code
B4X:
            Dim UpdateJob As HttpJob
            Dim Connected As Boolean = False
               
            UpdateJob.Initialize("", Me)
           
            UpdateJob.Download("https://<somewebsite>/Nothing.txt" &"?dummy=" &DateTime.Now)
   
            Try
                Wait For (UpdateJob) JobDone(UpdateJob As HttpJob)

                Connected = UpdateJob.Success
               
                If  Connected = False Then                   
                    UpdateJob.Release
                   
                    UpdateJob.Initialize("", Me)
           
                    UpdateJob.Download("http://<somewebsite>/Nothing.txt" &"?dummy=" &DateTime.Now)
   
                    Try
                        Wait For (UpdateJob) JobDone(UpdateJob As HttpJob)

                        Connected = UpdateJob.Success
                       
                        End If
                    Catch               
                        Log(LastException.Message)
                    End Try
                End If
            Catch
            End Try

            UpdateJob.Release

            return Connected

B4X:
Nothing.txt is a file with the word Nothing in it

NOTE: I have usesCleartextTraffic set to true in my manifest

BobVal
 
Top