BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-08-2009, 01:50 AM   #1 (permalink)
New Member
 
Join Date: Jan 2009
Model: 8800
PIN: N/A
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 2.3.0.54)


Thanks In Advance

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

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

            try
            {
                _instance._locationProvider = LocationProvider.getInstance(c);
                if ( _instance._locationProvider == null )
                {
                     _gpsPositionlistener.GPSPositionNotFound(GPSPositionListener.ERROR_NO_GPS_DEVICE_AVAILABLE);
                    return;
                }
                // 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){}
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Genuine OEM IBM Selectric I and II Typewriter Typing Elements Balls
$19.95
Genuine OEM IBM Selectric I and II Typewriter Typing Elements Balls pictureLot of 5 New OEM Genuine Ricoh IBM 39V3204 Toner Cartridge SEALED
$305.27
Lot of 5 New OEM Genuine Ricoh IBM 39V3204 Toner Cartridge SEALED pictureLot of 4 New OEM IBM 1372475 Pageprinter 3130 Fuser 100v
$9.34
Lot of 4 New OEM IBM 1372475 Pageprinter 3130 Fuser 100v pictureLot of 7 New OEM IBM 1372476 3130 Pageprinter Cleaning Kit
$0.89
Lot of 7 New OEM IBM 1372476 3130 Pageprinter Cleaning Kit  pictureLot of 4 New OEM IBM 44D7279 Infoprint 4100 toner cartridge
$0.89
Lot of 4 New OEM IBM 44D7279 Infoprint 4100 toner cartridge picture






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