Hi all,

I want to create app that will just show phones position as longitude and latitude. I have used jsr-179 and Java Platform Micro Edition Software Development Kit 3.0. When I am running this app on the emulator it shows position- Longitude 2.0 Latitude 2.0 (I assume that it is defaul position for emulator). After testing I have installed app on the NOKIA E71. When lounhed, program shows: Longitude 0.0 Latitude 0.0

I cant get anything than zeros in latitude and longitude fields
Thats the code:

package hello;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;

public class HelloMIDlet extends MIDlet implements CommandListener {

private Command exitCommand; // The exit command
private Display display; // The display for this MIDlet
public LocationProvider lp;
// public Location loc;
public double longitude, latitude;
public String dlugosc, szerokosc;


//public Criteria cr = new Criteria();
public HelloMIDlet() {

longitude = 0.0;
latitude = 0.0;

display = Display.getDisplay(this);
exitCommand = new Command("Exit", Command.EXIT, 0);
}

public void startApp() {

TextBox t = new TextBox("Position", "This will count position", 256, 0);
display.setCurrent(t);


createLocationProvider();
t.setString("counting GPS DATA ");
display.setCurrent(t);




try {


Location loc = lp.getLocation(10);
QualifiedCoordinates c = loc.getQualifiedCoordinates();
longitude = c.getLongitude();
latitude = c.getLatitude();

} catch (Exception e) {
}

dlugosc = Double.toString(longitude);
szerokosc = Double.toString(latitude);
t.setString("Longitude " + dlugosc + "\n Latitude " + szerokosc);
t.addCommand(exitCommand);
t.setCommandListener(this);

display.setCurrent(t);

}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
}

public void commandAction(Command c, Displayable s) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}

public boolean hasLocationAPI() {
if (System.getProperty("microedition.location.version") == null) {
return false;
} else {
return true;
}
}

void createLocationProvider() {
if (lp == null) {
Criteria cr = new Criteria();
cr.setHorizontalAccuracy(5000);
cr.setVerticalAccuracy(5000);

try {
lp = LocationProvider.getInstance(cr);
} catch (LocationException le) {
le.printStackTrace();
}
}
}
}


Can anyone help? What am I doing wrong?