I would like to be able to control the "supports-screens" element within the AndroidManifest.xml file when doing a build from the Cordova CLI.
Specifically, I'd like to control the following element within AndroidManifest.xml:
<supports-screens android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
Ideally, I'm hoping that there is a setting available within the Cordova config.xml file that would let me directly control the supported screen sizes.
I've tried monkeying around with config.xml settings like the following to no avail:
<platform name="android">
<supports-screen xlargeScreens="false"/>
</platform>
I recognize that I can store a customized AndroidManfiest.xml file in my source control and simply copy it around using a Cordova hook, but doing so feels a bit clunky, and I'm worried that future tweaks to the config.xml file might then not make it into the AndroidManifest.xml because we forgot that we're overwriting the generated file during an after_prepare hook.
Is what I'm asking possible using the Cordova CLI? If so, a sample of the config.xml to achieve this would be appreciated.
Since this change in the latest cordova > 6.3 versions, we should be able to use the new edit-config
tag to edit the Android Manifest.mf file like this:
<!-- For Cordova Android < 7, use file="AndroidManifest.xml" -->
<edit-config file="app/src/main/AndroidManifest.xml" target="/manifest/supports-screens" mode="merge">
<supports-screens android:resizeable=["true"| "false"]
android:smallScreens=["true" | "false"]
android:normalScreens=["true" | "false"]
android:largeScreens=["true" | "false"]
android:xlargeScreens=["true" | "false"]
android:anyDensity=["true" | "false"]
android:requiresSmallestWidthDp="integer"
android:compatibleWidthLimitDp="integer"
android:largestWidthLimitDp="integer"/>
</edit-config>
Also you'll need to add xmlns:android="http://schemas.android.com/apk/res/android"
to the widget element in config.xml.