Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Developer
Posts: 9
Registered: ‎11-18-2008
My Device: Not Specified

Getting location info

[ Edited ]


I am developing an application which gets the location info and reports it to a server. The application runs great on 8820 (has GPS), but there are some problems with 8320.

My main thread does:


while ( ! stopThread )
Alerts.showAlert("Locate." );
// get GPS
location = locater.getLocation();
if( location == null ){
Alerts.showAlert("Location null." );
else if( !location.isValid() ){
Alerts.showAlert("Location invalid." );
if ( location != null && location.isValid() ) {
// report GPS data

if((location.getQualifiedCoordinates().getLatitude() != 0 || location.getQualifiedCoordinates().getLongitude() != 0)){
Factory.getReporter().reportCoordinate( location );

sleep( Constants.REPORT_INTERVAL);
catch( Exception ex){}


 I get location with:


public Location getLocation(){
Location location = null ;
location = locationProvider.getLocation( 300 );
catch( LocationException e ){
Alerts.showAlert("LocationException" + e.getMessage());
catch (InterruptedException e ) {
catch(SecurityException e ) {
catch ( IllegalArgumentException e ){

return location;


I used null as criteria of the location provider.

When i run my application on 8320 the output is:


(without waiting for 300 sec timeout)

LocationException Timed out while waiting for GPS location

Location null.



Can anyone tell be what i am doing wrong? Or how can i get locationlike googlemap application?


Message Edited by mcadirci on 11-18-2008 01:27 PM
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Getting location info

Could this be because the 8320 doesn't have GPS?


Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: Getting location info

Having wasted a lot of time on this myself, complain to your carrier and demand they either activate

cell tower location or explicitly tell you when you get your data plan they won't provide US e911 mandated

facilities for your use. I've got nothing against anyone making money but this is stupid.


Also, after ranting, read the documentation Smiley Happy


If you select criteria that match the RIM implementation notes and your carrier provides cell tower location,

you should get something.


Google AFAIK has their own database. And, while you are at it, complain to the FCC that the carrier don't provide

matching info to phones to let you correlate fixed xmitter locations/call signs with cell ID etc. The FCC has

a public text document that is great but you can't query it with stuff your carrier provides to the phone AFAIK.