3

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.,

Kalai Selvan Ravi
  • 2,846
  • 2
  • 16
  • 28

3 Answers3

3

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.

Community
  • 1
  • 1
funkybro
  • 8,432
  • 6
  • 39
  • 52
  • I have tried **Nokia device:** Nokia-MIDlet-App-Orientation : Landscape **Samsung device:** MIDlet-ScreenMode : Landscape – Kalai Selvan Ravi Jun 19 '12 at 14:12
  • Thanks for your answer funkybro. I have some problem with it. When I am using **MIDlet-ScreenMode : Landscape**, I am not able to install the app in Nokia C5. It is showing "Compulsory attribute missing" because custom properties shouldn't start with **Midlet-**. Then, how can I use **MIDlet-ScreenMode : Landscape**? – Kalai Selvan Ravi Jun 19 '12 at 14:17
  • 1
    Heh, I thought that would happen. So now you will need to make separate distributables for each device! Isn't J2ME a laugh a minute? – funkybro Jun 19 '12 at 14:18
  • 1
    That's true funkybro. Each and every device has it's own JAD property to lock landscape mode. LG having separate attribute. Nokia having separate attribute. Samsung having separate attrbute. Lot of things to do one function in all devices. Instead of this, No other way to do this. I also thought of separate distributables for each device. Thanks for your ideas. – Kalai Selvan Ravi Jun 19 '12 at 14:25
  • 1
    Perhaps you could collect the proprietary JADs along with information about which JADs are not compatible with other devices (such as MIDlet-* on Nokia S40) and add them to this question so that others can refer to it? – funkybro Jun 19 '12 at 14:32
  • sure funkybro. After collecting it, I will post it. – Kalai Selvan Ravi Jun 19 '12 at 14:41
0

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.

Community
  • 1
  • 1
Telmo Pimentel Mota
  • 4,033
  • 16
  • 22
0

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.