14 Replies Latest reply on Jun 28, 2016 10:39 AM by mjrjweb

    After upgrading to latest phonegap version, permissions are no longer being set for android.

    mjrjweb Level 1

      I recently downloaded the latest "Hello World" phonegap project and moved my files to it. It solved an issue with a plugin I was having but every time I run a build in the CLI or with PGB, the permissions are no longer set for the plugins. It says the app requires "no special access" and when the camera is used it asks for permission. I need the permission set at install. Here is the config.xml

       

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

      <widget id="com.myapp.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" >

          <name>My name</name>

          <description>

             My description

          </description>

          <author email="support@website.com" href="http://website.com">

             My Team

          </author>

          <content src="index.html" />

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

          <preference name="DisallowOverscroll" value="true" />

          <preference name="StatusBarOverlaysWebView" value="false" />

          <preference name="StatusBarStyle" value="black-opaque" />

          <preference name="SuppressesLongPressGesture" value="true" />

          <preference name="Suppresses3DTouchGesture" value="true" />

          <preference name="ShowSplashScreenSpinner" value="true"/>

          <preference name="AutoHideSplashScreen" value="true" />

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

          <gap:plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1" />

          <gap:plugin name="cordova-plugin-console" source="npm" spec="~1.0.2" />

          <gap:plugin name="cordova-plugin-device" source="npm" spec="~1.1.1" />

          <gap:plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2" />

          <gap:plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0" />

          <gap:plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />

          <gap:plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />

          <gap:plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />

          <gap:plugin name="cordova-plugin-splashscreen" source="npm" spec="~3.2.1" />

          <gap:plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />

          <gap:plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />

          <gap:plugin name="phonegap-plugin-barcodescanner" source="npm" spec="~5.0.0" />

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

          <platform name="android">

              <icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />

              <icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />

              <icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />

              <icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />

              <icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />

              <icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />

              <gap:splash density="land-ldpi" src="www/res/screen/android/drawable-land-ldpi-screen.png" />

              <gap:splash density="land-mdpi" src="www/res/screen/android/drawable-land-mdpi-screen.png" />

              <gap:splash density="land-hdpi" src="www/res/screen/android/drawable-land-hdpi-screen.png" />

              <gap:splash density="land-xhdpi" src="www/res/screen/android/drawable-land-xhdpi-screen.png" />

              <gap:splash density="land-xxhdpi" src="www/res/screen/android/drawable-land-xxhdpi-screen.png" />

              <gap:splash density="land-xxxhdpi" src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" />

              <gap:splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />

              <gap:splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />

              <gap:splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />

              <gap:splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />

              <gap:splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />

              <gap:splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />

          </platform>

          <platform name="ios">

              <icon height="57" platform="ios" src="www/res/icon/ios/icon.png" width="57" />

              <icon height="114" platform="ios" src="www/res/icon/ios/icon@2x.png" width="114" />

              <icon height="40" platform="ios" src="www/res/icon/ios/icon-40.png" width="40" />

              <icon height="80" platform="ios" src="www/res/icon/ios/icon-40@2x.png" width="80" />

              <icon height="50" platform="ios" src="www/res/icon/ios/icon-50.png" width="50" />

              <icon height="100" platform="ios" src="www/res/icon/ios/icon-50@2x.png" width="100" />

              <icon height="60" platform="ios" src="www/res/icon/ios/icon-60.png" width="60" />

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

              <icon height="180" platform="ios" src="www/res/icon/ios/icon-60@3x.png" width="180" />

              <icon height="72" platform="ios" src="www/res/icon/ios/icon-72.png" width="72" />

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

              <icon height="76" platform="ios" src="www/res/icon/ios/icon-76.png" width="76" />

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

              <icon height="29" platform="ios" src="www/res/icon/ios/icon-small.png" width="29" />

              <icon height="58" platform="ios" src="www/res/icon/ios/icon-small@2x.png" width="58" />

              <icon height="87" platform="ios" src="www/res/icon/ios/icon-small@3x.png" width="87" />

              <gap:splash height="1136" platform="ios" src="www/res/screen/ios/Default-568h@2x~iphone.png" width="640" />

              <gap:splash height="1334" platform="ios" src="www/res/screen/ios/Default-667h.png" width="750" />

              <gap:splash height="2208" platform="ios" src="www/res/screen/ios/Default-736h.png" width="1242" />

              <gap:splash height="1242" platform="ios" src="www/res/screen/ios/Default-Landscape-736h.png" width="2208" />

              <gap:splash height="1536" platform="ios" src="www/res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" />

              <gap:splash height="768" platform="ios" src="www/res/screen/ios/Default-Landscape~ipad.png" width="1024" />

              <gap:splash height="2048" platform="ios" src="www/res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />

              <gap:splash height="1024" platform="ios" src="www/res/screen/ios/Default-Portrait~ipad.png" width="768" />

              <gap:splash height="960" platform="ios" src="www/res/screen/ios/Default@2x~iphone.png" width="640" />

              <gap:splash height="480" platform="ios" src="www/res/screen/ios/Default~iphone.png" width="320" />

          </platform>

          <access origin="*" />

          <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>

      </widget>

        • 1. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
          mjrjweb Level 1

          After deleting and recreating the app locally, the CLI "phonegap build android" puts in the permissions properly but PGB still does not. I deleted the app from PGB and recreated it but had no luck. PGB still says the app requires no special access.

          • 4. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
            mjrjweb Level 1

            It's now failing with the CLI build. Very hit or miss and frustrating.

             

             

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

            <widget id="com.my.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">

                <name>My App</name>

                <description/>

                <author email="support@my.com" href="http:/my.com">My Team</author>

                <content src="index.html" />

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

                <preference name="DisallowOverscroll" value="true" />

                <preference name="StatusBarOverlaysWebView" value="false" />

                <preference name="StatusBarStyle" value="black-opaque" />

                <preference name="SuppressesLongPressGesture" value="true" />

                <preference name="Suppresses3DTouchGesture" value="true" />

                <preference name="ShowSplashScreenSpinner" value="true"/>

                <preference name="AutoHideSplashScreen" value="true" />

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

                <plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1" />

                <plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1" />

                <plugin name="cordova-plugin-media-capture" source="npm" spec="~1.2.0" />

                <plugin name="cordova-plugin-console" source="npm" spec="~1.0.2" />

                <plugin name="cordova-plugin-contacts" source="npm" spec="~2.0.1" />

                <plugin name="cordova-plugin-device" source="npm" spec="~1.1.1" />

                <plugin name="cordova-plugin-device-motion" source="npm" spec="~1.2.0" />

                <plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2" />

                <plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0" />

                <plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />

                <plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0" />

                <plugin name="cordova-plugin-geolocation" source="npm" spec="~2.1.0" />

                <plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.3" />

                <plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />

                <plugin name="cordova-plugin-media" source="npm" spec="~2.2.0" />

                <plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />

                <plugin name="cordova-plugin-splashscreen" source="npm" spec="~3.2.1" />

                <plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />

                <plugin name="cordova-plugin-vibration" source="npm" spec="~2.1.0" />

                <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />

                <plugin name="phonegap-plugin-barcodescanner" source="npm" spec="~5.0.0" />

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

                <platform name="android">

                    <icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />

                    <icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />

                    <icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />

                    <icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />

                    <icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />

                    <icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />

                    <gap:splash density="land-ldpi" src="www/res/screen/android/drawable-land-ldpi-screen.png" />

                    <gap:splash density="land-mdpi" src="www/res/screen/android/drawable-land-mdpi-screen.png" />

                    <gap:splash density="land-hdpi" src="www/res/screen/android/drawable-land-hdpi-screen.png" />

                    <gap:splash density="land-xhdpi" src="www/res/screen/android/drawable-land-xhdpi-screen.png" />

                    <gap:splash density="land-xxhdpi" src="www/res/screen/android/drawable-land-xxhdpi-screen.png" />

                    <gap:splash density="land-xxxhdpi" src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" />

                    <gap:splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />

                    <gap:splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />

                    <gap:splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />

                    <gap:splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />

                    <gap:splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />

                    <gap:splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />

                </platform>

                <platform name="ios">

                    <icon height="57" platform="ios" src="www/res/icon/ios/icon.png" width="57" />

                    <icon height="114" platform="ios" src="www/res/icon/ios/icon@2x.png" width="114" />

                    <icon height="40" platform="ios" src="www/res/icon/ios/icon-40.png" width="40" />

                    <icon height="80" platform="ios" src="www/res/icon/ios/icon-40@2x.png" width="80" />

                    <icon height="50" platform="ios" src="www/res/icon/ios/icon-50.png" width="50" />

                    <icon height="100" platform="ios" src="www/res/icon/ios/icon-50@2x.png" width="100" />

                    <icon height="60" platform="ios" src="www/res/icon/ios/icon-60.png" width="60" />

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

                    <icon height="180" platform="ios" src="www/res/icon/ios/icon-60@3x.png" width="180" />

                    <icon height="72" platform="ios" src="www/res/icon/ios/icon-72.png" width="72" />

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

                    <icon height="76" platform="ios" src="www/res/icon/ios/icon-76.png" width="76" />

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

                    <icon height="29" platform="ios" src="www/res/icon/ios/icon-small.png" width="29" />

                    <icon height="58" platform="ios" src="www/res/icon/ios/icon-small@2x.png" width="58" />

                    <icon height="87" platform="ios" src="www/res/icon/ios/icon-small@3x.png" width="87" />

                    <gap:splash height="1136" platform="ios" src="www/res/screen/ios/Default-568h@2x~iphone.png" width="640" />

                    <gap:splash height="1334" platform="ios" src="www/res/screen/ios/Default-667h.png" width="750" />

                    <gap:splash height="2208" platform="ios" src="www/res/screen/ios/Default-736h.png" width="1242" />

                    <gap:splash height="1242" platform="ios" src="www/res/screen/ios/Default-Landscape-736h.png" width="2208" />

                    <gap:splash height="1536" platform="ios" src="www/res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" />

                    <gap:splash height="768" platform="ios" src="www/res/screen/ios/Default-Landscape~ipad.png" width="1024" />

                    <gap:splash height="2048" platform="ios" src="www/res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" />

                    <gap:splash height="1024" platform="ios" src="www/res/screen/ios/Default-Portrait~ipad.png" width="768" />

                    <gap:splash height="960" platform="ios" src="www/res/screen/ios/Default@2x~iphone.png" width="640" />

                    <gap:splash height="480" platform="ios" src="www/res/screen/ios/Default~iphone.png" width="320" />

                </platform>

                <access origin="*" />

                <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>

            </widget>

            • 5. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
              mjrjweb Level 1

              The log says it's added the permission:

               

              ADDED from /Volumes/Macintosh HD 2/Sites/my/mine/platforms/android/AndroidManifest.xml:43:22-63

              uses-permission#android.permission.CAMERA

               

              Yet when installing, it requests no permissions.

              • 6. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                mjrjweb Level 1

                I've isolated the issue to the barcode scanner. As soon as I add that plugin, the permissions disappear. Unfortunately, I need the barcode scanner.

                • 7. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                  mjrjweb Level 1

                  Steps to reproduce:

                   

                   

                  1. Create new phonegap "Hello World" app

                  2. Build using CLI or PGB - App REQUESTS perms for plugins properly before install

                  3. Install barcode scanner: phonegap plugin add phonegap-plugin-barcodescanner

                  4. Add to config.xml <plugin name="phonegap-plugin-barcodescanner" source="npm" spec="~5.0.0" />

                  5. Build using CLI or PGB - App WIPES all perms for plugins before install and says no special access required.

                   

                   

                  <content src="index.html" />

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

                      <preference name="DisallowOverscroll" value="true" />

                      <preference name="StatusBarOverlaysWebView" value="false" />

                      <preference name="StatusBarStyle" value="black-opaque" />

                      <preference name="SuppressesLongPressGesture" value="true" />

                      <preference name="Suppresses3DTouchGesture" value="true" />

                      <preference name="ShowSplashScreenSpinner" value="true"/>

                      <preference name="AutoHideSplashScreen" value="true" />

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

                      <plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1" />

                      <plugin name="cordova-plugin-camera" source="npm" spec="~2.1.1" />

                      <plugin name="cordova-plugin-media-capture" source="npm" spec="~1.2.0" />

                      <plugin name="cordova-plugin-console" source="npm" spec="~1.0.2" />

                      <plugin name="cordova-plugin-contacts" source="npm" spec="~2.0.1" />

                      <plugin name="cordova-plugin-device" source="npm" spec="~1.1.1" />

                      <plugin name="cordova-plugin-device-motion" source="npm" spec="~1.2.0" />

                      <plugin name="cordova-plugin-device-orientation" source="npm" spec="~1.0.2" />

                      <plugin name="cordova-plugin-dialogs" source="npm" spec="~1.2.0" />

                      <plugin name="cordova-plugin-file" source="npm" spec="~4.1.1" />

                      <plugin name="cordova-plugin-file-transfer" source="npm" spec="~1.5.0" />

                      <plugin name="cordova-plugin-geolocation" source="npm" spec="~2.1.0" />

                      <plugin name="cordova-plugin-globalization" source="npm" spec="~1.0.3" />

                      <plugin name="cordova-plugin-inappbrowser" source="npm" spec="~1.3.0" />

                      <plugin name="cordova-plugin-media" source="npm" spec="~2.2.0" />

                      <plugin name="cordova-plugin-network-information" source="npm" spec="~1.2.0" />

                      <plugin name="cordova-plugin-splashscreen" source="npm" spec="~3.2.1" />

                      <plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.2" />

                      <plugin name="cordova-plugin-vibration" source="npm" spec="~2.1.0" />

                      <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.2.1" />

                      <plugin name="phonegap-plugin-barcodescanner" source="npm" spec="~5.0.0" />

                  • 8. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                    mjrjweb Level 1

                    This fixed the issue:

                     

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

                    • 9. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                      CAMAEL

                      Hi, i think i'm having the same problem but the same solution might not work.

                       

                      Here is my config.xml (same for rootProjectDirectory/config.xml and rootProjectDirectory/www/config.xml)

                      [XML] <widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1 - Pastebin.com

                       

                      Using this file the android manifest always auto generate himself with the full permissions requirment: (even if if delete them before)

                      [XML] <?xml version='1.0' encoding='utf-8'?> <manifest android:hardwareAccelerated="t - Pastebin.com

                      Can you help me please? Cause my app do not need any permissions (except accessing to internet and using local storage for cache management)

                      • 10. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                        kerrishotts Adobe Community Professional

                        Are you building with the CLI or PhoneGap Build? If the former, simply commenting out the plugin in config.xml won't remove the plugin from your project. You'd need to "cordova plugin rm cordova-plugin-id".

                         

                        Also, some of the plugins you haven't commented out will require additional permissions (e.g., media and vibration plugins).

                        1 person found this helpful
                        • 11. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                          CAMAEL Level 1

                          Thanks that solved my problem.

                          cordova plugin rm cordova-plugin-id

                           

                          I also had to do this to make it work on the phonegap desktop app

                          phonegap platform rm browser

                          phonegap platform add browser

                          before doing the rm / add platform phonegap was trying to load the removed plugin.

                          • 12. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                            mjrjweb Level 1

                            This is now no longer working in PGB. It works for the CLI, permissions are properly set but now, for some reason, PGB is back to removing all permissions for android.

                             

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

                            • 13. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                              mjrjweb Level 1

                              After updating the CLI, it now also removes all android permissions.

                               

                              Is there any way to set permissions for the camera in android at build?

                              • 14. Re: After upgrading to latest phonegap version, permissions are no longer being set for android.
                                mjrjweb Level 1

                                issue was with just-in-time permissions for the camera. Updated to cordova-plugin-camera 2.2.0 and just-in-time permissions didn't crash the app.

                                 

                                Apparently, targeting a specific android sdk in the config.xml no longer works with PGB for permissions on install.