5 Replies Latest reply on Nov 24, 2016 2:26 PM by alond83602031

    Can't connect with my server after updating the plugins from gap to NPM

    alond83602031 Level 1

      Hi,

      I tried to update my app to the NPM plugins, after PGB plugins were shutdown.

      The only changes I made were at the config.xml file:

      I removed:

      <gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">

        <param name="APP_ID" value="xxxx" />

        <param name="APP_NAME" value="xxx" />

      </gap:plugin>

      <gap:plugin name="org.apache.cordova.geolocation" version="0.3.10" />

      <gap:plugin name="org.apache.cordova.network-information" version="0.2.12" />

      <gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />

      <gap:plugin name="org.apache.cordova.device" version="0.2.12" />

       

      and instead added to the code:

      <plugin name="pgb-facebook-connect" spec="0.12.0">

        <param name="APP_ID" value="XXX" />

        <param name="APP_NAME" value="XXX" />

      </plugin>

      <plugin name="cordova-plugin-geolocation" spec="~2.4.0" />

      <plugin name="cordova-plugin-network-information" spec="~1.3.0" />

      <plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" />

      <plugin name="cordova-plugin-device" spec="~1.1.3" />

       

      and also added (due to request from one of the new NPM plugins):

      <preference name="android-minSdkVersion" value="22" />

      just  below the icon src decleration, and above:

      <access origin="*" />

       

      No other change was made in the code. Everything works now except I can't send or receive requests from my server. I get a 404 respond when trying to contact the server with xmlrequest, I can't understand how the these issue can be triggered from these changes. The old .apk file with the PGB plugins still works fine.

       

      Please help,

      Thanks

      Alon

        • 1. Re: Can't connect with my server after updating the plugins from gap to NPM
          ryanskihead Adobe Employee

          404 implies that it is successfully connecting to your server, but not finding your resource. I'd suggest re-checking your request urls.

          • 2. Re: Can't connect with my server after updating the plugins from gap to NPM
            ryanskihead Adobe Employee

            Also are you declaring your phonegap-version? If not, it may have auto-upgraded to the default versions since you last built which would introduce changes.

            • 3. Re: Can't connect with my server after updating the plugins from gap to NPM
              alond83602031 Level 1

              Thanks for your reply.

              I double checked the request url. It's just the same as the one in the old package that used PGB plugins in the config file. No other changes were made. Can;t understand how it can affect the server request.

               

              I am not sure about the phonegap-version. I don't think I declared here something, neither in the old config file. Which version should I declare and how?

              Attached is all of the config file. Maybe some other ideas will come up. again, no other changes were made in the rest of the files of the project. Please help.

              Thanks

               

              <?xml version="1.0" encoding="UTF-8" ?>

                  <widget xmlns   = "http://www.w3.org/ns/widgets"

                      xmlns:gap   = "http://phonegap.com/ns/1.0"

                xmlns:android   = "http://schemas.android.com/apk/res/android"

                      id          = "XXXX"

                      versionCode = "102"

                      version     = "1.1.1" >

                 <name>XXX</name>

                <description>

                     XXX

                  </description>

                <preference name="android-minSdkVersion" value="22" />

               

                <icon src="images/icon.png" />

                <icon src="icon-57.png" gap:platform="ios" width="57" height="57" />

                <icon src="icon-57@2x.png" gap:platform="ios" width="114" height="114" />

                <icon src="icon-60.png" gap:platform="ios" width="60" height="60" />

                <icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />

                <icon src="icon-72.png" gap:platform="ios" width="72" height="72" />

                <icon src="icon-72@2x.png" gap:platform="ios" width="144" height="144" />

                <icon src="icon-76.png" gap:platform="ios" width="76" height="76" />

                <icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />

               

                <access origin="*" />

                <gap:config-file platform="android" parent="/manifest" overwrite="true">

                <application android:theme="@android:style/Theme.NoTitleBar"></application>

                </gap:config-file>

               

                <gap:config-file platform="ios" parent="CFBundleVersion"><string>108</string></gap:config-file>

               

                 <plugin name="pgb-facebook-connect" spec="0.12.0">

                <param name="APP_ID" value="XXX" />

                <param name="APP_NAME" value="XXX" />

                </plugin>

                <plugin name="cordova-plugin-geolocation" spec="~2.4.0" />

                <plugin name="cordova-plugin-network-information" spec="~1.3.0" />

                <plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" />

                <plugin name="cordova-plugin-device" spec="~1.1.3" />

               

                <gap:splash src="images/splash.png" />

                <gap:splash src="splash/ios/splash-320.png" gap:platform="ios" width="320" height="480" />

                <gap:splash src="splash/ios/splash-480.png" gap:platform="ios" width="480" height="320" />

                <gap:splash src="splash/ios/splash-768.png" gap:platform="ios" width="768" height="1024" />

                <gap:splash src="splash/ios/splash-1024.png" gap:platform="ios" width="1024" height="768" />

                <gap:splash src="splash/ios/splash-640-1136.png" gap:platform="ios" width="640" height="1136" />

                <gap:splash src="splash/ios/splash-640-960.png" gap:platform="ios" width="640" height="960" />

                <gap:splash src="splash/ios/splash-960-640.png" gap:platform="ios" width="960" height="640" />

                <gap:splash src="splash/ios/splash-1536-2008.png" gap:platform="ios" width="1536" height="2008" />

                <gap:splash src="splash/ios/splash-2048-1496.png" gap:platform="ios" width="2048" height="1496" />

               

               

              </widget>

              • 4. Re: Can't connect with my server after updating the plugins from gap to NPM
                ryanskihead Adobe Employee

                Do you own the server? Can you inspect the request on the server side? Again, if it was an issue of the request being blocked, you shouldn't see a 404...

                 

                Try cli-5.4.1 and see if that changes things

                 

                <preference name="phonegap-version" value="cli-5.4.1" />

                 

                Also, try adding the cordova-whitelist plugin.

                • 5. Re: Can't connect with my server after updating the plugins from gap to NPM
                  alond83602031 Level 1

                  Thanks the cordova-whitelist plugin fix it.