0
votes

I´m making a simple GET request in titanium and it seems to be that in versions of android 5.0 and up doesn´t work correctly. Here is the response of the console that im receiving.

< ANDROID 5.0

[INFO] : Status: 200, connectionType: GET

=> ANDROID 5.0

{"source":{"password":null,"status":0,"username":null,"autoRedirect":true,"bubbleParent":true,"allResponseHeaders":"","location":"","autoEncodeUrl":true,"apiName":"Ti.Network.HTTPClient","responseXML":null,"validatesSecureCertificate":false,"readyState":1,"domain":null,"responseText":"","responseData":null,"connectionType":"GET","statusText":null,"connected":false,"_events":{"disposehandle":{}}},"error":"Handshake failed","code":-1,"success":false}

ERROR: "Handshake failed"

Here is the code that im using.

var url = "MY URL";

        var loader = Titanium.Network.createHTTPClient();

        loader.onload = function() 
        {
            Titanium.API.info('Status: ' + this.status);
            Titanium.API.info('ResponseText: ' + this.responseText);
            Titanium.API.info('connectionType: ' + this.connectionType);
            Titanium.API.info('location: ' + this.location);
        };

        loader.onerror = function (e) {
          console.log(JSON.stringify(e));
          console.log("ERROR: " + JSON.stringify(e.error));
        };

        loader.open("GET",url);
        loader.send();

Hope you can help me with this.

1
It seems to be that if you are using a https:// url the request will not work in Android 5.0 and up. What I did is remove the S and just leave it as http, but this is not a permanent solution because there might be web services that requires https:// - OtnielGomez

1 Answers

0
votes

This is an issue with the SSL certificate of the webserver.

You can verify that the certificate is valid from Chrome:

SLL Facebook