1

I used Cordova 4.0 to create a phonegap app (that has worked fine via cli on iOS), but I also want to use build.phonegap.com particularly for Android.

The main issue is that upon installing the APK on Android, the security warning lists all features, when I do not actually need any.

I have read that you can remove all permissions with <preference name="permissions" value="none" />and then selectively add back the ones you want.

However, this is not working; I still get all the permissions requested upon install. I must be missing something, or something has changed. (Did I make a mistake using Cordova instead of Phonegap? That's reasonably easy to correct..)

My config.xml is below:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test" version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap="phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android">
    <name>Test</name>
    <description>
        Test.
    </description>
    <author email="test@test.com" href="http://test.com">
        Test
    </author>
    <content src="index.html" />
    <access origin="*" />

    <gap:plugin name="org.apache.cordova.statusbar" />
    <preference name="StatusBarOverlaysWebView" value="false" /> 
    <preference name="StatusBarBackgroundColor" value="#ffffff" />
    <preference name="StatusBarStyle" value="default" />
    <preference name="DisallowOverscroll" value="true" />

    <preference name="permissions" value="none" />

</widget>

Edit: To remove ambiguity, I want to remove the Android security warnings saying this app needs full access to contacts, camera, internet access, etc. I do not need any of these.

Community
  • 1
  • 1
markau
  • 854
  • 8
  • 21
  • 1
    Which version of phonegap is listed in phonegap build for your project? (for phonegap 3+, only permissions required by installed plugins should be asked) – QuickFix Nov 25 '14 at 15:38
  • 1
    and the widget definition in your config.xml seems weird, did you modify it manually or was it generated by a CLI? (I see a mix of cordova and phonegap + reference to android I've never seen in a config.xml) – QuickFix Nov 25 '14 at 15:41
  • Hey thanks, Phonegap build only lists up to 3.6.3, so I set it to that. The config.xml was generated with Cordova 4.0 command line. I added the `xmlns:android = "http://schemas.android.com/apk/res/android"` myself in an attempt to solve this, from the phonegap build docs. I shall take a look at this config.xml and see if I can improve it. Thanks for your input. – markau Nov 26 '14 at 00:01
  • 1
    The config.xml generated by phonegap only contains xmlns:gap. This contains syntax for both cordova and phonegap. Strange that you have too many permissions with 3.6.3. – QuickFix Nov 26 '14 at 08:34
  • I downloaded Phonegap and modified the sample config.xml to suit my application, and it works perfectly now, thanks a lot! (Although still requires full internet access which I'd like to remove, but it's much improved!) I must have made the Cordova config.xml malformed; regardless, it is quite minimal compared to what you get with Phonegap. Thanks again. – markau Nov 26 '14 at 21:51

1 Answers1

2

config.xml , is just a bunch of information. It is not executed sequentially. so if you mention you require DisallowOverscroll permission and then mention you dont require any permission, it means ,

<preference name="permissions" value="none" /> 

will not overWrite

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

for example:

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

    <preference name="permissions" value="none" />

and

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

<preference name="permissions" value="none" />

both are same.

Naeem Shaikh
  • 15,331
  • 6
  • 50
  • 88
  • Thanks. Is your suggestion to move the `` above any other preference declaration? That makes sense, but unfortunately has not solved the problem. – markau Nov 25 '14 at 13:36
  • no.. why are you setting other preferences in config.xml. if you dont want them. – Naeem Shaikh Nov 25 '14 at 14:45
  • 1
    Sorry for confusion. I need those preferences "disallow overscroll" etc. I have edited the question; what I mean is that I want to remove the Android security warnings saying this app needs full access to contacts, camera, internet access, etc. I do not need any of these. – markau Nov 25 '14 at 23:59