Trying to restrict orientation on phones to portrait. Using the screen orientation plugin, I can lock the device-
screen.lockOrientation('portrait');
However, I only want to lock the device when it is a phone or it is smaller than a 7 inch device. Is this possible without writing a plugin for ionic? With iOS there is the ability to detect ionic.Platform.isIPad()
,as well as options in xcode allows you to set orientations for phone and tablet differently.
Please advice what is the best way to do this? I have tried window.screen.width and a few other like window.devicePixelRatio
. However, no way to tell if I am dealing with a phone or tablet.
Thanks for your help.