6 Replies Latest reply on Sep 1, 2017 7:41 AM by thomasp4

    Installed APK files do not see network!

    thomasp4

      Was a big IntelXDK developer, so I am relatively new the the Phonegap service so please excuse me if this has already been answered.

       

      When I create apps in Phonegap (HTML5) they work fine when testing locally on the PC or via the mobile Phonegap environment.  However, when I build the app via Phonegap build website and copy, then install the app (the APK file) onto my mobile device, any feature of the app that require network access no longer work.

       

      Can anyone tell me what is causing this issue?

        • 1. Re: Installed APK files do not see network!
          kerrishotts Adobe Employee

          Could be a couple of things:

           

          1. Missing/incorrectly configured whitelist. See Whitelist - Apache Cordova

          2. Incorrectly configured CORS (be sure to allow for null origins, since most Cordova apps will come from file://!)

          3. Incorrectly configured CSP meta tag (content-security-policy).

          4. Incorrectly configured SSL certificate if using https (you are using https, right?)

           

          If you want to post your config.xml (for 1), and index.html file (for 3), you may, but be sure to redact any sensitive/private info.

           

          Also, it would help if you can debug your app using Chrome so that you can see what error messages are being logged -- that will almost certainly point you to the issue.

          • 2. Re: Installed APK files do not see network!
            thomasp4 Level 1

            Thanks not using https; just file:// and http:// as the app references just simple images.  See the below xml.  Thanks for the quick response!

            ------------------------------------------------------------------------------------------ -----------------

            <?xml version='1.0' encoding='utf-8'?>

            <widget id="uas107.openrobotix.labs" version="1.9.2" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

                <name>UAS107</name>

                <description>

                    UAS107 is a FAA Part 107 practice exam with study resources.

                </description>

                <author email="info@openrobotix.com" href="http://openrobotix.com">

                    OpenRobotix Labs

                </author>

                <access origin="*"/>

            <icon platform="android" src="package-assets/icon72.png" density="hdpi" width="72" height="72"/>

            <icon platform="android" src="package-assets/icon48.png" density="mdpi" width="48" height="48"/>

            <icon platform="android" src="package-assets/icon36.png" density="ldpi" width="36" height="36"/>

            <icon platform="android" src="package-assets/icon96.png" density="xhdpi" width="96" height="96"/>

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

            <preference name="android-targetSdkVersion" value="26"/>

            <platform name="android">

            <preference name="Orientation" value="portrait"/></platform>

            </widget>

            • 3. Re: Installed APK files do not see network!
              kerrishotts Adobe Employee

              Ok -- so you've got <access origin=...>, but I don't see a reference to the whitelist plugin. You need that too:

               

              If you're using the CLI, just type

               

              cordova plugin add cordova-plugin-whitelist

               

              If you're using PGB, edit config.xml:

              <plugin name="cordova-plugin-whitelist" />

              • 4. Re: Installed APK files do not see network!
                thomasp4 Level 1

                Thanks.  This does help.  But in the IntelXDK I never had to do this, only right my code.  So how do I reference or install the  plugin.  Do you have an example somewhere I can reference.  Thanks for you help !!!

                • 5. Re: Installed APK files do not see network!
                  kerrishotts Adobe Employee

                  OK - first things: are you using PhoneGap Build to build your app, or are you building locally?

                  • 6. Re: Installed APK files do not see network!
                    thomasp4 Level 1

                    I figured it out from your first reply.  Thanks a bunch !!!!