Вопрос

I want to show my app only in portrait mode. I have to restrict the landscape mode in my app.

There are separate attributes for each devices.

For Nokia, Nokia-MIDlet-App-Orientation : Portrait. For Samsung, MIDlet-ScreenMode : Portrait.

After adding these in JAD, I tried to install it in Nokia C5. I am unable to install it. I am getting Compulsory attribute missing error because custom JAD property shouldn't start with MIDlet-. I am unable to install it because of MIDlet-ScreenMode : Portrait property.

Is there any general code to lock the landscape mode in all devices like NOKIA, LG, Motorola, Samsung etc.,

Это было полезно?

Решение

There is no way in MIDP to lock an app to an orientation. This is usually implemented via proprietary JAD parameters on different devices. You need to find out what these parameters are for the devices you wish to target and add them to your JAD.

Some methods to do this are in the answer to this question.

Другие советы

If your apps GUI is implemented based on Canvas you can do it programatically. At this other answer Create Landscape Game Canvas for Asha 303 I show how to keep the landscape mode, but the same principle can be aplied to keep the app as portrait.

It's a bit stressful but you could add an orientation listener and when the orientation changes, you could set the orientation value back to portrait.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top