如何将权限添加到Android的PhoneGap项目? [英] How to add permissions to Android PhoneGap project?

查看:608
本文介绍了如何将权限添加到Android的PhoneGap项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用访问的AccountManager通过PhoneGap的Andr​​oid的一个插件需要一定的权限。我使用PhoneGap的3.4.0。在我的WWW文件夹中的config.xml中有一个标签

 < preference名=权限的价值=无​​/>
 

我有困难的时候搞清楚如何我将权限添加到该config.xml文件。所有我发现的其他问题说来改变清单文件,但那种感觉,我错了设置这么多的事情在这个config.xml文件。

如何添加在config.xml文件的权限?逗号分隔的列表中上面引用的标签?

下面是我已经加入到我的清单文件的权限:

 <使用-权限的Andr​​oid:名称=android.permission.MANAGE_ACCOUNTS/>
<使用-权限的Andr​​oid:名称=android.permission.AUTHENTICATE_ACCOUNTS/>
<使用-权限的Andr​​oid:名称=android.permission.GET_ACCOUNTS/>
<使用-权限的Andr​​oid:名称=android.permission.USE_CREDENTIALS/>
 

解决方案

请检查您已声明了以下内容。

 <功能名称=NetworkStatus>
         < PARAM NAME =Android的包值=CDVConnection/>
 < /功能>
 

网络状态将是功能名称和值将是你的类名。

在Android清单,

 <使用-权限的Andr​​oid:名称=android.permission.READ_PHONE_STATE/>
 

麻生检查cordova_plugin.js

  cordova.define('科尔多瓦/ plugin_list',功能(需,出口,模块){
    module.exports = [{
        文件:插件/ org.apache.cordova.dialogs / WWW / notification.js
        ID:org.apache.cordova.dialogs.notification
        合并:navigator.notification]
    },{
        文件:插件/ org.apache.cordova.network信息/ WWW / network.js
        ID:org.apache.cordova.network-information.network
        则会覆盖:navigator.connection,navigator.network.connection]
    }];
    module.exports.metadata = // TOP元数据
    {
        org.apache.cordova.device:0.2.8,
        org.apache.cordova.network信息:0.2.7
    }
});
 

这些都是一些权限类型。

感谢。

A plugin I am using to access the AccountManager in android through phonegap requires some permissions. I am using PhoneGap 3.4.0. In the config.xml in my www folder there is a tag

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

I am having the hardest time figuring out how I add permissions to this config.xml file. All the other questions I've found say to alter the manifest file, but that feels wrong with me setting so many things in this config.xml file.

How do I add the permissions in the config.xml file? Comma separated list in the tag referenced above?

Here are the permissions I have added to my manifest file:

<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

解决方案

Please check you have declared the following.

 <feature name="NetworkStatus">
         <param name="android-package" value="CDVConnection" />
 </feature>

Network status will be the feature name and value will be your class name.

In Android Manifest,

 <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Aso check cordova_plugin.js

cordova.define('cordova/plugin_list', function(require, exports, module) {
    module.exports = [{
        "file": "plugins/org.apache.cordova.dialogs/www/notification.js",
        "id": "org.apache.cordova.dialogs.notification",
        "merges": ["navigator.notification"]
    }, {
        "file": "plugins/org.apache.cordova.network-information/www/network.js",
        "id": "org.apache.cordova.network-information.network",
        "clobbers": ["navigator.connection", "navigator.network.connection"]
    }];
    module.exports.metadata = // TOP OF METADATA 
    {
        "org.apache.cordova.device": "0.2.8",
        "org.apache.cordova.network-information": "0.2.7"
    }
});

These are some permission types.

Thanks.

这篇关于如何将权限添加到Android的PhoneGap项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆