I'm building an app using [email protected], and I'm trying to control my screen orientation for each screen. I'm using the plugin [email protected].
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.
The problem is not with any plugin. The reason for this not working is that Cordova doesn't run with the command ionic serve. So it'll not work in the inspect tab. Use an emulator instead, it'll work just fine.
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