Phonegap Serve, Build Phonegap and MySql

2

I'm developing an app using jquery mobile and phonegap . Question: Why when I test the application in 'phonegap serve' of node.js it works and when I download apk created by Buil Phonegap no?

Example: if I try to communicate with an external database ( mysql ) via the phonegap it works, but not by apk.

My query code is:

$(document).on('click', '#envcep', function() {
 var cep1 = $("#cep").val();
 var n = cep1.length;
 if (n < 8) {
  $("#mesg").text("CEP incompleto.");
  $("#dialog2").popup('open');
  return true;
 } else {

   var data = $("#app").serialize();
   $.ajax
      ({
       type: "POST",
       url: "http://meuwebsite.com.br/aplicativo/cep.php",
       data: data,
       cache: false,
       success:

    function(resposta) {...

Detail: my config.xml already has: access origin="*" access origin="http://mysite.com"

Where would the error be? What would be the difference between testing an application with the phonegap service and the apk generated by the phonegap build?

Thank you !!

    
asked by anonymous 22.10.2015 / 18:42

1 answer

3

Well, after a lot of trying, I found out where the problem was:

In the new version of Phonegap, it creates in config.xml the following lines:

<access origin="*" />
<access origin="http://www.diskebeba.com.br/aplicativo" subdomains="true"/>
<access origin="tel:*" launch-external="yes" /> 
<plugin name="cordova-plugin-whitelist" version="1" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>

I deleted ALL and replaces only with:

access origin="*" launch-external="yes"

Just remembering that it was only tested on Android.

I appreciate the answers and / or comments and hope this helps in some way.

    
22.10.2015 / 21:44