I'm building an app using ionic@2.2.1, and I'm trying to control my screen orientation for each screen. I'm using the plugin cordova-plugin-screen-orientation@2.0.2.
and I use the following code to change the orientation
screen.orientation.unlock();
screen.orientation.lock('portrait');
However my screen orientation doesn't change. I'm getting this error when inspecting the code.
Uncaught (in promise) DOMException: screen.orientation.lock() is not available on this device.
Please help.