Welcome!

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

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

Getting location info

[ Edited ]

Hello,

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 );
}
}
Alerts.showAlert("Sleep");

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

 

 I get location with:

 

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

return location;
}

 

I used null as criteria of the location provider.

When i run my application on 8320 the output is:

Locate

(without waiting for 300 sec timeout)

LocationException Timed out while waiting for GPS location

Location null.

Sleep.

 

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

Thanks.

Message Edited by mcadirci on 11-18-2008 01:27 PM
Developer
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?

http://na.blackberry.com/eng/devices/features/gps.jsp

Developer
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.