Wednesday, April 13, 2011

Titanium createHTTPClient issue on Android

Setting up an Android app on Titanium, I was having problems getting a webservice using a signature. It was working fine on iPhone. Turns out that Titanium auto url encodes the url in an createHTTPClient.open() method -- thus sending a different string than the signature had hecked against -- and thus returning an error.

To fix it, do this:

var xhr = Titanium.Network.createHTTPClient();
xhr.autoEncodeUrl = false;

before you call the open() method.

No comments: