Skip to main content

J2me Limitations in Windows Mobile

2 replies [Last post]
Joined: 2009-08-11

What are the APIs (JSR) in J2ME will support for windows mobile. Could any one know please help..

I want to find out Location API (JSR 179) in j2me will support windows mobile 6 or not..

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-08-11

The below code i have written for test GPS in windows mobile HTC, using Esmertec Jbed to test. The application not get any error. Every time am getting the invalid location like(Latitude 0.0 ,Longitude 0.0 ).

If i opened the google maps and came back to my application in HTC TY TN II it return values up to 5 to 10 mimes. Does any one now is there is any problem with the code or any other.

My thinking is my when i run my j2me application its not triggering to get the information from satellite, Its just returns the information from the GPS Driver .

Does any one knows how to fix this issue..please help me..

package com.gps;

import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.location.Location;
import javax.microedition.location.LocationException;
import javax.microedition.location.LocationProvider;
import javax.microedition.location.QualifiedCoordinates;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class TestGps extends MIDlet implements CommandListener {

private Display display;
private Form form;
public StringItem si;
private Command cmdExit, cmdOK;
public LocationProvider _locationProvider = null;
public Timer updateTimer = new Timer();

public TestGps() {

display = Display.getDisplay(this);

form = new Form("Location Test");

cmdExit = new Command("Exit", Command.EXIT, 2);
cmdOK = new Command("OK", Command.OK, 1);
si = new StringItem("Geo Location", null);
// GPSTimer gPSTimer=new GPSTimer();
// updateTimer.schedule(gPSTimer,0, 500);



public void displayString(String string) {

protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {

protected void pauseApp() {

protected void startApp() {

public void commandAction(Command c, Displayable d) {

if (c == cmdOK) {
// GPSThread gPSThread=new GPSThread();
// getLocation();
GPSTimer gPSTimer = new GPSTimer();
updateTimer.schedule(gPSTimer, 0, 1000 * 20);
if (c == cmdExit) {
try {
} catch (MIDletStateChangeException ex) {

public void updateLocation() {
try {

Location lp = null;

// if(gpsValue){
// _locationProvider.setLocationListener(null, -1, -1, -1);
// gpsValue=false;
// }

if (_locationProvider == null) {
_locationProvider = LocationProvider.getInstance(null);
try {
lp = _locationProvider.getLocation(400);

} catch (InterruptedException ex) {
} catch (LocationException ex) {
QualifiedCoordinates cord = lp.getQualifiedCoordinates();
int locmeth=lp.getLocationMethod();

if (lp.isValid()) {
System.out.print("Latitude: " + cord.getLatitude() + " Longitude : " + cord.getLongitude() +
" Altitude : " + cord.getAltitude());
form.append("Latitude: " + cord.getLatitude() + " Longitude :" + cord.getLongitude() + " Altitude:" + cord.getAltitude());

} else {
form.append("location is invalid");
System.out.print("location is invalid");

} catch (LocationException ex) {


private class GPSTimer extends TimerTask {

public void run() {


Terrence Barr - Senior Technologist and Ambassador

It depends on which Java ME stack you are referring to.

For phoneME Advanced you can find the list of implemented JSRs here

For the JavaFX Mobile 1.2 EA release for Windows Mobile you can
find the list of JSRs in the Release Notes: (click on the "JavaFX Mobile" bundle)

You also may have a Java ME stack from a different vendor already
installed on you Windows Mobile device, for example JBlend by
Esmertec. Consult their documentation for details.

Hope that helps,

-- Terrence wrote:
> What are the APIs (JSR) in J2ME will support for windows mobile. Could any one know please help..
> I want to find out Location API (JSR 179) in j2me will support windows mobile 6 or not..
> [Message sent by forum member 'praveen0922' (praveen0922)]
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail: