<config-file>
看起来超有用的重写....唉似乎这是一个PhoneGap唯一的功能。对于科尔多瓦,你可能需要使用挂钩。
一个很好的例子可以发现HERE
伊夫修改脚本中加入我需要的功能(我需要GPS和摄像头是可选功能)。
module.exports = function (context) {
var fs = context.requireCordovaModule('fs'),
path = context.requireCordovaModule('path');
var platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
var manifestFile = path.join(platformRoot, 'AndroidManifest.xml');
if (fs.existsSync(manifestFile)) {
fs.readFile(manifestFile, 'utf8', function (err, data) {
if (err) {
throw new Error('Unable to find AndroidManifest.xml: ' + err);
}
var insertAt = data.indexOf("</manifest>");
var optionalFeatures = "<uses-feature android:name=\"android.hardware.LOCATION\" android:required=\"false\"/><uses-feature android:name=\"android.hardware.location.GPS\" android:required=\"false\"/><uses-feature android:name=\"android.hardware.camera\" android:required=\"false\"/><uses-feature android:name=\"android.hardware.camera.autofocus\" android:required=\"false\"/>";
var result = data.slice(0, insertAt) + optionalFeatures + data.slice(insertAt);
fs.writeFile(manifestFile, result, 'utf8', function (err) {
if (err) throw new Error('Unable to write into AndroidManifest.xml: ' + err);
})
});
}
};
然后设置钩config.xml中
<hook type="after_build" src="scripts/afterBuild.js" />
希望它能帮助[Android的PhoneGap的配置XML用户许可(的
可能重复http://stackoverflow.com/questions/26440655/ android-phonegap-config-xml-user-permission) – 2015-04-03 14:49:19
感谢@JamesBaxter的关注。我在问这个问题之前检查了点,但它没有帮助,因为我想让它们不是必需的,而不是让它们成为应用程序所需的东西......或者我错过了一些关于它的信息 – borna 2015-04-03 14:53:23
对不起,我的错不能正确理解 - 我已经提出了一个更清晰的问题,以防其他人可以帮助 – 2015-04-03 14:58:16