PhoneGap-将Android功能设为可选 [英] PhoneGap - Make Android feature optional

查看:70
本文介绍了PhoneGap-将Android功能设为可选的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的Android应用程序不需要设置几个设置,因此Google Play商店会认识到它对平板电脑也很有用. 我需要将这两行添加到我的AndroidManifest.xml中:

I want set couple of settings not to be required for my android app so Google' play store will recognize it also useful for tablets. I need add these two lines to my AndroidManifest.xml:

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />

由于我使用PhoneGap构建来编译我的应用程序,因此我需要以某种方式将它们添加到 config.xml 文件中,因此PhoneGap将在构建过程中将它们添加到正确的位置(我想).但是没有成功!我是否需要使用任何特定的语法来添加 uses-feature 通过 config.xml 文件?

Since I use PhoneGap build to compile my app, I need somehow add them to the config.xml file, so PhoneGap will add them to the right place during build process (I guess) ... But no success! Is there any specific syntax I need to use to add uses-feature through config.xml file?

请注意,通过在我的 config.xml 文件中添加以下行,我对设置 minSdkVersion 所做的操作几乎相同,在构建后,我将其保存在清单文件中: /p>

Note that I did almost same thing for setting minSdkVersion by adding line below to my config.xml file, and after build I have it in my manifest file:

<preference name="android-minSdkVersion" value="11" />

推荐答案

找到了解决方案!基于 PhoneGap文档-配置文件元素,只需添加类似这到我的"config.xml"文件中:

Found the solution! Based on PhoneGap Documentation - Config File Elements, just need to add something like this to my 'config.xml' file:

<gap:config-file platform="android" parent="/manifest" mode="add">
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />
</gap:config-file>

还需要将间隙名称空间添加到 widget 节点:

Adding gap namespace to widget node, is also needed:

xmlns:gap="http://phonegap.com/ns/1.0"

这篇关于PhoneGap-将Android功能设为可选的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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