I'm using cordova cli to build my app. I want to target both android and ios (maybe more).
As I want this to be true for all platforms, I was hoping I could simply define this as a preference in the config.xml like this:
<preference name="orientation" value="landscape" />
because this is apparently how it works in the phonegap build https://build.phonegap.com/docs/config-xml
I assume the features supported in config.xml by phonegap build are different to those by cordova-cli?
I know I can force it in the android app by inserting android:screenOrientation="landscape"
into my AndroidManifest.xml, but that's no good because it will be over-written the next time I perform a cordova build
.
Any suggestions?
This is no longer the case. The "orientation" preference in the config.xml is now honored by the cordova cli starting from version 3.4
This is the corresponding issue : https://issues.apache.org/jira/browse/CB-5634
Simply put, it's not possible to set the orientation using a preference
element in the www/config.xml
. After inspecting the cordova-cli code it appears that only the version and entry class package are updated in the AndroidManifest.xml
.
For a list of supported preferences see the Cordova Docs.
Added configurations to the AndroidManifest.xml
file should not be lost on cordova build
, unless the config option is pulled from somewhere else (i.e. version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With