简体   繁体   English

Cordova 4.0 config.xml中的Android权限

[英]Android permissions in Cordova 4.0 config.xml

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. 我使用Cordova 4.0创建了一个phonegap应用程序(通过iOS上的cli可以正常工作),但我也想使用build.phonegap.com,尤其是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. 主要问题是在Android上安装APK时,安全警告列出了所有我不需要的功能。

I have read that you can remove all permissions with <preference name="permissions" value="none" /> and then selectively add back the ones you want. 我已经读到您可以使用<preference name="permissions" value="none" />删除所有权限,然后有选择地重新添加所需的<preference name="permissions" value="none" />

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..) (我是否使用Cordova而不是Phonegap犯了错误?这很容易纠正。)

My config.xml is below: 我的config.xml如下:

<?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. 编辑:为了消除歧义,我想删除Android安全警告,说此应用程序需要对联系人,相机,互联网访问权限的完全访问权限。我不需要这些。

config.xml , is just a bunch of information. config.xml只是一堆信息。 It is not executed sequentially. 它不会顺序执行。 so if you mention you require DisallowOverscroll permission and then mention you dont require any permission, it means , 因此,如果您提到需要DisallowOverscroll权限,然后再提及不需要任何权限,则表示,

<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. 两者都是一样的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM