I just started using ionic framework and would like to know how do I set the orientation of the ionic app for android and ios either to: portrait, landscape or both (portrait and landscape)?
Well its a cordova issue, so not much we can do really. You might have a better chance of getting this resolved if you bring this up to the cordova people
Actually I’m not sure if that’s the issue… The docs have it as capitalized and so is my implementation, however after looking into the cordova CLI library (cordova/metadata/) the ios_parser.js file doesnt look for orientation, while android/amazon fireos/firefoxos do, so this may be a cordova bug.
In the meantime, I created a cordova hook which got published in the new version of the yeoman-ionic generator called update_platform_config. I also have some docs on how you can add some configuration to your config.xml which will modify your plist value…
By using the hook, you should be able to add the following to your config.xml and update the config as you would like to see it. I would only go this route if it’s a confirmed Cordova bug though.
@djett Thanks so much for that hook, it solved the issue for us!
I could not find an exact issue on the Codrova project that referenced that as a bug, but as far as I can tell, it is one.
Kind of shocking that the Cordova CLI still has this rather fundamental bug, even in v5.3.3! You’d think app orientation would be one of the more important things to get working…
Thanks for the config-file hook workaround, it worked around the problem very cleanly for me. Just “npm install cordova-config-utils”, add the XML to the config.xml file, and the problem was solved.
I did a plugin with the code of @djett … maybe it’s useful for someone so i published it: cordova-plugin-settings-hook .
This way you just have to add the plugin:
I experienced a similar issue trying to get all orientations selected by default on iOS. It seems default is landscape and portrait on Android, but just portrait on iOS. This selects all for iOS:
I am not sure if this thread is still active, but I have problem with the yoik’s orientation plugin. Just wonder if anyone is experiencing same as me and do you have any work around for that?
Since yoik’s plugin is not working for me, so I lock the whole app with in config.xml. Everything is working as expected, but splashscreen where it is display in portrait.
Could it be that I don’t have proper png for my phone? I changed all the png to landscape, but it didn’t work.