Search code examples
androidcordovaphonegap-builduses-feature

PhoneGap - Make Android feature optional


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" />

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?

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" />

Solution

  • 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>
    

    Adding gap namespace to widget node, is also needed:

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