cordova-删除不必要的权限 [英] cordova - remove unnecessary permissions
问题描述
我需要在游戏中播放声音,因此我在应用程序中添加了org.apache.cordova.media插件.现在platform/android/AndroidManifest.xml包含2个我不需要的条目:
I need to play sounds in my game, so I added org.apache.cordova.media plugin to my application. Now platforms/android/AndroidManifest.xml contains 2 entries I don't need:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
如果我删除了这些行,将重新生成此文件,并再次添加权限.删除这些权限的正确方法是什么?我使用的是Apache Cordova 3.5.0
If I remove those lines, this file regenerated and permissions are added again. What is correct way to remove these permissions? I use apache cordova 3.5.0
推荐答案
您必须打开plugins/android.json
,在该文件部分中找到
You have to open plugins/android.json
, locate in that file part which looks like
"AndroidManifest.xml": {
"parents": {
"/*": [
......
{
"xml": "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" />",
"count": 1
},
......
{
"xml": "<uses-permission android:name=\"android.permission.RECORD_AUDIO\" />",
"count": 1
},
......
],
并删除这些文件.删除这些行之后,请确保android.json
仍然是有效的JSON文件.
还请注意count
属性,该属性指示有多少插件使用该权限.如果您的价值大于1,则应该找到其他哪些插件可以使用该权限.另外,我不确定是否已测试Cordova插件在没有适当权限的情况下是否可以正常使用,因此从该文件中删除权限时,您将自己承担责任.
and remove these files. After removal of that lines, make sure that android.json
still be valid JSON file.
Also please notice the count
property which indicates how many plugins use the permissions. If you have value more then 1 you should find which other plugins could use that permission. Also I don't sure that Cordova plugins was tested to be workable without proper permissions, so you on your own when removing permissions from that file.
如果您将系统置于故障状态,则始终可以删除平台和插件文件夹的所有内容,并通过运行来重新创建项目
If you put your system in the broken state, you always could remove all content of platforms and plugins folders and recreate your project by running
cordova create ...
cordova platform add ...
cordova plugin add ...
这篇关于cordova-删除不必要的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!