Screen orientation issue

Hi,

I searched here and google to find an answer and nothing seems to be truly clear about doing it in ionic 2. I’m trying to lock the screen orientation:

this.platform.ready().then(() => {
     screen.lockOrientation('landscape'); 
}

this doesn’t work.I’m still able to switch from portrait to landscape. I don’t know if I miss any config? I read something about the config.xml file but doesn’t seem to work either.

I’m testing from the IonicView app on my iPhone 6s.

If you guys could help me figure this out!!

Thanks :slight_smile:

Hello @skoff

I was also looking for this and found here .As per that we need to set Orientation in config.xml. Basically it is a cordova configuration that we specify using config.xml in the project. I didn’t test it though, may be you can test it and please let me know if it works for you.

Please look at this link for more configuration options.

Regards
Vijay

1 Like

I’ll try that maybe tonight or tomorrow morning and let you know!

many thanks!

the only problem I can see with the first link you provide is that I would like to force the orientation on a single specific view and that can’t be done with adding the config inside config.xml. I would like to know if there’s a way to make it work without the config.xml for only one specific view.