1

First, sorry for my bad english, and thanks for stop by,

I need to know if is possible prevent the Orientation change to make the APP with static portait all the time. No change orientation with any orientation change in portait, and if the device is rotate 90 or 180 degrees, the screen don't change.

I used a cordova-plugin-screen-orientation, and i can make a portrait or landscape but always change orientation with 180 degrees rotate of the device...

I proved with manifest android:screenOrientation and the options, but no results...

Someone could help me!?

Thanks!

Armando
  • 43
  • 6
  • 1
    Possible duplicate of [How to prevent a Phonegap application to switch to landscape view](https://stackoverflow.com/questions/23673892/how-to-prevent-a-phonegap-application-to-switch-to-landscape-view) – Matej Kormuth Jun 22 '17 at 08:34
  • That topic refer the orientation Change from portrait to landscape or viceversa, but not the 180 degrees change... thanks anyway :) – Armando Jun 22 '17 at 09:24
  • See my answer on https://stackoverflow.com/questions/44491204/prevent-180-degree-flip-ios-cordova/44494601#44494601 – jcesarmobile Jun 23 '17 at 08:06

1 Answers1

0

I am able to lock the screen orientation without any plugin.

For Android, putting the following in config.xml seems to work for me:

<platform name="android">
  <preference name="orientation" value="portrait" />
</platform>

For iOS I set the permitted orientation in Xcode, in the General/Deployment Info section.

For locking/unlocking on the fly, you could try https://github.com/cogitor/PhoneGap-OrientationLock.

user1527225
  • 1,059
  • 9
  • 7
  • Hello and thanks for the help :) , i proved that (manifest) and the same result with the plugin cordova-plugin-screen-orientation (plugin) or screen.lockOrientation('portrait-primary'); The problem that, in all the cases, the screen rotate with screen 180º orientation change and don't lock in portrait-primary only :(, in the mozilla fundation web, Screen.lockOrientation() says: "Note: This method only works for installed Web apps or for Web pages in full-screen mode." , iu put in fullscreen, and the same result. i really think that im doing something bad... – Armando Jun 23 '17 at 09:53