How to limit the use of j2me only in landscape mode

I am developing an application using J2ME and LWUIT. I want to run this application only in landscape mode. For Nokia there is an attribute: Nokia-MIDlet-App-Orientation: landscape, but for another device. What is the attribute restricting the application to landscape mode only? How to achieve this for different J2ME devices?

+4
source share
3 answers

The following is an attribute to restrict the application to landscape mode only.

Nokia device:

Nokia-MIDlet-App-Orientation : Landscape 

Samsung device:

 MIDlet-ScreenMode : Landscape 
+6
source

If you want to lock the screen orientation in LWUIT, you must use a combination of the following methods.

Display.isPortrait() Returns true if the device is currently in portrait mode. Display.canForceOrientation() Returns true if the device allows you to impose orientation using code, phones with functions do not allow this, although some of them include a jad property that allows you to use this function. Display.lockOrientation(boolean portrait) On devices that return true for canForceOrientation (), this method can block the orientation of the device in either portrait or landscape mode.

Hope this helps you.

+3
source

I check the Display.canForceOrientation () method, this gives an incorrect answer because the value in LWUITImplementation.java is hardcoded and always returns false. Therefore, in LWUIT, if we want to limit the application, the only way to do this is to add a JAD attribute using code, this is not possible.

0
source

Source: https://habr.com/ru/post/1389016/


All Articles