Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Location MIDlet closed after 110th orientation call in S60 5th Edition (Known Issue)

From Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia N97, Nokia N97 mini
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: Orientation.getOrientation()
Created: User:Kbwiki (23 Apr 2010)
Last edited: hamishwillee (26 Jun 2013)


Orientation.getOrientation() returns the terminal's current orientation. This information can be retrieved from Nokia devices equipped with built-in magnetometer hardware.

On S60 5th Edition devices, heavy usage of Orientation.getOrientation() results in the location MIDlet closing either without an exception or with java.lang.OutOfMemoryError. The closing happens right after the 110th method call.

How to reproduce

  1. Implement a test MIDlet by using the following code:
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    import javax.microedition.location.LocationException;
    import javax.microedition.location.Orientation;
    import javax.microedition.midlet.*;
    public class LocationTest extends MIDlet {
    Display d;
    Form f;
    boolean running = false;
    Thread t = null;
    protected int interval = 1000;
    public LocationTest() {
    f=new Form("Location Test");
    public void startApp() {
    public void show(String s) {
    //Implement the orientation updating activity within a thread
    public void startRequesting() {
    t = new Thread(new Runnable() {
    public void run() {
    running = true;
    try {
    while (running) {
    } catch (InterruptedException ex) {
    show("Exception: "+ex.toString());
    int num = 0;
    private void updateOrientation() {
    Orientation o;
    String s;
    try {
    o = Orientation.getOrientation();
    show("Orientation.getOrientation(): "+num);
    catch (LocationException ex) {
    show("Exception: " +ex.toString());
    public void pauseApp() {
    public void destroyApp(boolean unconditional) {
  2. Install the MIDlet and wait for it to reach the 110th method call of Orientation.getOrientation().


This issue is expected to be fixed in future firmware releases for the affected devices.

This page was last modified on 26 June 2013, at 05:28.
82 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.