whitebear whitebear - 11 months ago 58
Android Question

Amazon SNS URL works on browser but not from Android app

I made the url for amazon SNS.


This url looks complex however, I have confirmed this url is correct.

I put this url on browser it works fine.

However when I try this from very simple application,
It returns 400 bad request error.

This is very simple titanium source code.

var xhrSNS = Ti.Network.createHTTPClient({
onload :function(e) {
Ti.API.info("testPost query:" + JSON.stringify(e));
onerror : function(e){
Ti.API.debug("error:" + e.error);

I just confused why the same url works on browser and not android.

Moreover, I have confiremd this titanium source code is correct.

Is there any other points I need to check??

Answer Source

You should check log of Amazon SNS to know why HTTP error 400 is triggered. Sometime web server application refuse to handle client request, for example, due to firewall blocks the request because it does not have proper user agent information. This is possible. So you should investigate it from server side first.