Android debuggable = false causing jQuery.ajax POST error in Cordova / Phonegap Eclipse project

I have an Android application built into Eclipse that uses Cordova 2.0.0. When it is built and downloaded to the phone using the Eclipse debugger, the application works fine, but when I install android: debuggable = "false" in the AndroidManifest file, jQuery.ajax () POST fails. I have nothing to say about the reason for the failure in the LogCat trace.

Here's the jQuery.ajax call:

jQuery.ajax({ url: that.endpoint, data: that.data, dataType: "json", type: "POST", contentType: "application/json", success: successHandler, error: errorHandler, timeout: serviceTimeout }); 

When android: debuggable = "true", it works fine and goes to the success handler, but when it's android: debuggable = "false", it goes to Handler's failure, and only textStatus has the value "error" and doesn't indicate anything else why it doesn't managed. When it fails, it seems that the message does not occur, because I see that it does not get into the web service that I am trying to call.

Does anyone have any idea why this debugged flag could affect my application this way?

What else, besides the logging level, will affect the debugged flag?

Any hints or pointers are welcome.

Greetings

+4
source share
2 answers

Found the reason for this. My code was ok. The problem was the SSL certificate of the web service I was trying to invoke. Although my browser said that everything was fine when I verified it with SSL certificate verification ( http://www.geocerts.com/ssl_checker ), it showed me that there is a release with a certificate hierarchy. Committing the certificate allowed my code to work.

I have never had this problem with the iPhone version of the application, so it seems that Android is more strict with checking the SSL certificate (and it does not check the certificate when working in debug mode.)

+5
source

If your application has debug = false set, you must specify the URI where the application gets its data from. When in debug mode, your permissions are relaxed, not in debug mode. See this link: http://developer.android.com/guide/topics/providers/content-provider-basics.html#Permissions

Your code looks good, and the fact that it only fails to install your application on a more stringent debug = false tells me that you do not have the correct URI permissions. That I look the first anyway.

0
source

All Articles