This hook can update platform configuration files based on preferences and config-file data defined in your normal config.xml, that are normally not used/ignored by Cordova. Use-cases include e.g. on iOS setting ENABLE_BITCODE = NO
or disabling Application Transport Security (ATS). Currently only the AndroidManifest.xml
, iOS *-Info.plist
and *.xcodeproj/project.pbxproj
files are supported.
Based off this awesome hook from Diego Netto, thanks!
npm install cordova-config-utils
After install an after_prepare
folder will be added to your hooks
folder with the 011_update_config.js
script in it.
You can use <preference>
and <config-file>
tags:
<platform name="android">
<!-- These preferences are actually available in Cordova by default although not currently documented -->
<preference name="android-minSdkVersion" value="8" />
<preference name="android-maxSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="19" />
<!-- Custom preferences examples -->
<preference name="android-windowSoftInputMode" value="stateVisible" />
<preference name="android-installLocation" value="auto" />
<preference name="android-launchMode" value="singleTop" />
<preference name="android-activity-hardwareAccelerated" value="false" />
<preference name="android-manifest-hardwareAccelerated" value="false" />
<preference name="android-configChanges" value="orientation" />
<preference name="android-theme" value="@android:style/Theme.Black.NoTitleBar" />
<config-file target="AndroidManifest.xml" parent="/*">
<supports-screens
android:xlargeScreens="false"
android:largeScreens="false"
android:smallScreens="false" />
<uses-permission android:name="android.permission.READ_CONTACTS" android:maxSdkVersion="15" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
</config-file>
</platform>
NOTE: For possible manifest values see http://developer.android.com/guide/topics/manifest/manifest-intro.html
<platform name="ios">
<config-file platform="ios" target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
</config-file>
<config-file platform="ios" target="project.pbxproj">
<build-property name="ENABLE_BITCODE" value="NO" />
</config-file>
</platform>