I need my app to be portrait only, except for one page that needs to be landscape only (full-screen video).
I’ve been looking for a solution for hours, and I’m about to have a nervous breakdown.
I have this plugin: cordova-plugin-screen-orientation 1.4.2 "Screen Orientation"
My code:
import {Component} from '@angular/core';
import {NavController, Platform} from 'ionic-angular';
import { ScreenOrientation } from 'ionic-native';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, public platform:Platform) {
//check if on mobile device to avoid ionic serve browser errors
if (platform.is('cordova')){
ScreenOrientation.lockOrientation('portrait');
}
}
}
I also have this line in my config.xml
file:
<preference name="Orientation" value="portrait"/>
When I run my code in the iOS emulator, this all seems to work fine.
When I test the app in Ionic View (both iOS and Android), orientation doesn’t get locked.
Another issue I’m having is quite similar: In config.xml I have this line:
<preference name="StatusBarStyle" value="blackTranslucent" />
The status bar color changes in the iOS emulator, but on my iOS device it doesn’t do anything.
My system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v4.4.0
Xcode version: Xcode 8.2.1 Build version 8C1002
```
Thoughts?