It looks like you aren't locking your plugin versions -- this means that every time you build, you're pulling the latest. When new plugins versions are released, your app may change behaviour as a result. Try locking your whitelist plugin to a previous version and see if that fixes things.
Additionally you can connect the Chrome Debugger (assuming you're on Android) and examine the request response to see a specific error code.
sorry it was a typo.. its cordova-plugin-whitelist
a. Do you have both config.xml and index.html in the root directory of your zip file?
b. Are you waiting for the deviceready event to fire before attepting to perform an ajax request?
the folder structure is as follows:
yea. I am waiting for deviceready event before performing anything.
PS - you may find it trivial, but
1. the exact same code was working till 2 weeks back, and it stopped working suddenly.
2. the same code, if I do a local build, the app works fine. remote build is creating the problem.
Is there any difference release and debug builds?
I am okay with locking the versions - but I am not sure what changed and where to look for solution. My release cycle has gone for a toss with this.
Does this mean I need to rebuild the app from front to back with the cordova-plugin-whitelist plugin and see which works?
The request is for a data to backend for some action, and the response is json. I caught the fail event and it says statuscode 0
For PGB, your config and index must be in the root of your zip file in order to make PGB find them.
again, is this a recent change ? as far as I know, phonegap automatically copies the config.xml to the www directory on its own
Looking at your app on the server, the config.xml is being picked up, so your folder structure should be fine.
You're neither explicitly setting your plugin versions nor your phonegap-version -- so each time you build, it will use the latest of those, which can and do change.
One thing might be if its running correctly locally with the cli, you can use "phonegap plugin list" to see what versions you're using locally, and then go to the "Plugins" tab on PGB and see the versions there, and look for any glaring inconsistencies. A
On PGB because you're not setting your phonegap-version in your config.xml, PGB will use the default of cli-6.3.0 (see http://build.phonegap.com/current-support). This was updated in the last couple of months, and may have caused changes.
thanks for your feedback. What I wil do is -
go through the plugin list and lock their versions in config.xml and try to do a build.
I update Phonegap CLI reqularly not knowing the seriousness.
I went through each plugin and set a version against it. But it still is a problem. If you recall, I had mentioned that local build works fine. Upon creating a release build it also fails. So basically, something is not being set in release mode.
I am at my wits end with this.
1 person found this helpful
I have solved the issue. Its not directly related to CSP / cordova-plugin-whitelist. When you have done everything right and still ajax isnt working, look at your SSL (that is if you are using one!). my SSL certificate was not recognized by android.
In Debug mode, it overrides the SSL issues (so it worked). In Release mode it failed silently and caused the problem.
I updated the root certificate / intermediate certificate / site certificates to resolve it
Nice find, thanks for sharing your solution!
May be this is a god send. Please find my question here
I am using HTTPS and I am testing it on IOS.
How do I upload the certificate and where ?
Btw, I have self signed certificate (for now)