BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 05-21-2007, 10:16 AM   #1 (permalink)
Thumbs Must Hurt
Join Date: Jul 2006
Location: Atlanta
Model: 8703e
Carrier: Sprint
Posts: 58
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default GPS Location API problem

Please Login to Remove!

having some trouble with the Location API.

So i'm finally writing an application that deals with GPS Data but its always timing out. This will run on a sprint blackberry 8703e which has a built in GPS.
Any ideas why this always times out ?

                    // Set criteria for selecting a location provider:
                    Criteria cr= new Criteria();
                    // Get an instance of the provider
                    LocationProvider lp= LocationProvider.getInstance(cr);

                    // Request the location, setting a 60 second timeout
                    Location l = lp.getLocation(60); //always times out
                    Coordinates c = l.getQualifiedCoordinates();
                    double longitude = 0;
                    double latitude = 0;
                    float course = l.getCourse();
                    float speed = l.getSpeed();
                    long timestamp = l.getTimestamp();                
                    if(c != null ) 
                        // Use coordinate information
                        latitude = c.getLatitude();
                        longitude = c.getLongitude();
                     System.out.println("Lon" + longitude + " Lat "+ latitude + " course "+course+" speed "+speed+" timestamp "+timestamp);
                catch(LocationException le)
                    System.out.println("Location exception "+le);
                catch(InterruptedException ie)
                    System.out.println("Interrupted exception "+ie);
Cingular BB 7290 and Sprint BB 8703e.
Old 05-23-2007, 05:21 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
Skipper_Joe's Avatar
Join Date: Jan 2007
Location: Kharkov, Ukraine
Model: 8300
Carrier: N/A
Posts: 237
Post Thanks: 0
Thanked 0 Times in 0 Posts

We had similar problems with default Criteria. try to define some attributes for Criteria:

and set timeout to 300, not 60.

Useful link:
How To - Define criteria to retrieve a GPS fix

Last edited by Skipper_Joe : 05-23-2007 at 05:22 AM.

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.