×
Namespaces

Variants
Actions
Revision as of 08:28, 26 June 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

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

Description

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() {
     
    d=Display.getDisplay(this);
    f=new Form("Location Test");
    startRequesting();
    }
     
    public void startApp() {
    d.setCurrent(f);
    }
     
     
    public void show(String s) {
    f.append(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) {
    updateOrientation();
    Thread.sleep(interval);
    }
    } catch (InterruptedException ex) {
    show("Exception: "+ex.toString());
    }
    }
    });
    t.start();
    }
     
    int num = 0;
    private void updateOrientation() {
     
    Orientation o;
    String s;
    try {
    f.deleteAll();
    o = Orientation.getOrientation();
    show("Orientation.getOrientation(): "+num);
    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().

Solution

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 08:28.
68 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.

×