Namespaces
Variants
Actions

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

Jump to: navigation, search
Article Metadata

Tested with
Devices(s): Nokia N97, Nokia N97 mini

Compatibility
Platform(s): S60 5th Edition

Article
Keywords: Orientation.getOrientation()
Created: User:Kbwiki (23 Apr 2010)
Last edited: hamishwillee (18 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 18 June 2013, at 04:48.
81 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved