Two Laptop Bag
The moose likes Java Micro Edition and the fly likes Location Api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Location Api" Watch "Location Api" New topic
Author

Location Api

Anil Kukreti
Greenhorn

Joined: Oct 13, 2007
Posts: 11

Hi friends I am new to J2me programs development.
I 've written a program to access the location coordinates of a cell phone. Whenever i am running it on emulator, it's running fine but as soon as i am checking it on Nokia N82 it is raising "Location Exception". The code is as
public FindLocation(LocationMidlet locationMidlet){
this.locationMidlet = locationMidlet;
cr.setHorizontalAccuracy(500);
cr.setVerticalAccuracy(500);
try{
lp = LocationProvider.getInstance(null);
l = lp.getLocation(10);
}catch(LocationException e){
this.locationMidlet.list.append("Location Exception",null);
}
}catch(Exception e){
this.locationMidlet.list.append(""+e,null);
}

if(c!=null){
this.locationMidlet.list.append(" "+c.getLatitude(),null);
}
}
thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17145
    
  27

It would probably help if you printed the message text for the exception.


An IDE is no substitute for an Intelligent Developer.
Austin Lee
Ranch Hand

Joined: Feb 18, 2008
Posts: 56
Try use the sdk of Nokia.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Location Api
 
It's not a secret anymore!