BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 01-08-2009, 12:50 AM   #1 (permalink)
New Member
Join Date: Jan 2009
Model: 8800
Carrier: Airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Location API not working for custom/third-party applications

Please Login to Remove!

I'm trying to write a simple GPS based application for my BB 8800.

But for some reason my code getLocation(timeout) always returns with a non-valid location (only after timing out). I tried different combinations of criteria parameters with no success.

I'm pretty sure that the problem is not with my code because even the BlackBerry GPS demo application does not work. However, my GPS receiver is working fine because "Wayfinder", a maps application that came bundled with my BB, works fine.

To test it further, I tried running SpotFinder and Google Maps. But they did not work either. Google Maps could determine location using cell tower info but not GPS.

Here are some more details about my environment,
1. Phone Model: BlackBerry 8800
2. Carrier: AirTel (India)
3. Device Version: 4.2.168 (Platform

Thanks In Advance

Last edited by nikhilbelsare : 01-08-2009 at 12:51 AM. Reason: Title was incorrect
Old 02-26-2009, 09:39 AM   #2 (permalink)
New Member
Join Date: Jan 2008
Model: 7100T
Carrier: none
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts

Ive had some trouble as well in the past, but I've managed to overcome any problems. Try this:
            Criteria c = new Criteria();
            // We're aiming for Assisted and/or Autonomous GPS
            c.setCostAllowed(true);                                         // this means 'allow assisted GPS', as the network will be used
            c.setSpeedAndCourseRequired(true);                              // overriden from default
            c.setPreferredPowerConsumption(Criteria.POWER_USAGE_HIGH);      // This signifies Ass. GPS and Aut. GPS

                _instance._locationProvider = LocationProvider.getInstance(c);
                if ( _instance._locationProvider == null )
                // we want fixes every 3 seconds, when the GPS is on
                // for every fix during those 3 seconds, we filter the invalid locations (i.e., 
                // those that do not qualify as full-fledged GPS locations)
                // we don't use timeout, or maxage, as we determine for ourselves what locations
                // we want to use
                _instance._locationProvider.setLocationListener(_instance, 3, -1, -1);

            catch (LocationException ex){}
            catch (SecurityException ex){} 
            catch (IllegalArgumentException e){}

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