Nokia 6300 problem with location coordinates
Hi all i have written this piece of code below. It works fine when in the java wireless tool kit emulator. However when i put the program on my nokia 6300 it comes up with the error "No Class Def Found Error java/lang/NoClassDef FoundError javax/microedition/location/Coordinates
[CODE]import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;
public class test extends MIDlet implements CommandListener{
private Display display;
private TextBox textbox;
private Command quitCommand;
private double lon;
private double lat;
private Location l;
public void startApp()
{
try
{
// Set criteria for selecting a location provider:
// accurate to 500 meters horizontally
Criteria cr= new Criteria();
cr.setHorizontalAccuracy(500);
// Get an instance of the provider
LocationProvider lp= LocationProvider.getInstance(cr);
// Request the location, setting a one-minute timeout
l = lp.getLocation(60);
Coordinates c = l.getQualifiedCoordinates();
if(c != null ) {
// Use coordinate information
lat = c.getLatitude();
lon = c.getLongitude();
}
}
catch(Exception e)
{
lon = 0.0;
lat = 0.0;
}
display = Display.getDisplay(this);
quitCommand = new Command ("Quit",Command.SCREEN,1);
textbox =new TextBox ("Location Test", l,40,0);
textbox .addCommand (quitCommand);
textbox .setCommandListener(this);
display .setCurrent(textbox);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction (Command choice, Displayable displayable)
{
if (choice == quitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
}[/CODE] Can any one help at all
Re: Nokia 6300 problem with location coordinates
6300 does not support Location API. You need to use bluetooth API, connect to the GPS receiver and retrieve/parse the NMEA sentences yourself.
Hartti
Re: Nokia 6300 problem with location coordinates
If got a similiar problem while using the location API. I think the 6300 does not support that API. If you got a solution on that, please keep me up to date!
SORRY! I did no recognize that someone else already answered!
Is there any solution known, how to use the API on a 6300 instead of using bluetooth and GPS receiver???
Re: Nokia 6300 problem with location coordinates
There is no other solution than what I offered above.
Hartti
Re: Nokia 6300 problem with location coordinates
[QUOTE=ninetailedrat;358332]Hi all i have written this piece of code below. It works fine when in the java wireless tool kit emulator. However when i put the program on my nokia 6300 it comes up with the error "No Class Def Found Error java/lang/NoClassDef FoundError javax/microedition/location/Coordinates
[CODE]import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;
public class test extends MIDlet implements CommandListener{
private Display display;
private TextBox textbox;
private Command quitCommand;
private double lon;
private double lat;
private Location l;
public void startApp()
{
try
{
// Set criteria for selecting a location provider:
// accurate to 500 meters horizontally
Criteria cr= new Criteria();
cr.setHorizontalAccuracy(500);
// Get an instance of the provider
LocationProvider lp= LocationProvider.getInstance(cr);
// Request the location, setting a one-minute timeout
l = lp.getLocation(60);
Coordinates c = l.getQualifiedCoordinates();
if(c != null ) {
// Use coordinate information
lat = c.getLatitude();
lon = c.getLongitude();
}
}
catch(Exception e)
{
lon = 0.0;
lat = 0.0;
}
display = Display.getDisplay(this);
quitCommand = new Command ("Quit",Command.SCREEN,1);
textbox =new TextBox ("Location Test", l,40,0);
textbox .addCommand (quitCommand);
textbox .setCommandListener(this);
display .setCurrent(textbox);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction (Command choice, Displayable displayable)
{
if (choice == quitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}
}[/CODE] Can any one help at all[/QUOTE]
I just tried it using NOKIA N95 without problems. Maybe NOKIA 6300 doesn't support that