BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 12-04-2008, 07:08 AM   #1
oli77za
New Member
 
Join Date: Dec 2008
Model: 8310
PIN: N/A
Carrier: o2
Posts: 3
Default Activating GPS device

Please Login to Remove!

Hi,

I'm writing an application that needs to use GPS position, and I wrapped the logic about the GPS in a class that I call LocationManager.

When I activate the LocationManager I register with the LocationProvider, with a very small timeout.

I find that, on some devices (some 8310 and 8130), the location provider does not return a valid location until the GPS is used by another application (e.g. refreshing the location through Options->Advanced Options->GPS, or BB Maps).


Following is the code where I'm activating the LocationManager. Am I missing something?

Code:
	private final static int LOCATION_UPDATE_INTERVAL = 1;

      ...

	public void activateLocationManager() {
		try {
			locationProvider = LocationProvider.getInstance(new Criteria());
			if (locationProvider != null) {
				resetGpsDevice();
		} catch (LocationException e) {
			MyApplicationClass.log("Could not get location provider", EventLogger.ERROR);
		}
	}

	public void resetGpsDevice() {
		if (locationProvider != null) {
			locationProvider.setLocationListener(null, 0, 0, 0);
			locationProvider.reset();
			locationProvider.setLocationListener(this,
					LOCATION_UPDATE_INTERVAL, 1, 1);
		}
	}

Thanks,
Oliver
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


NEW Sick Photoelectric Switch Sensor WTV4-3P2241  picture

NEW Sick Photoelectric Switch Sensor WTV4-3P2241

$210.00



Omron Switch Module D4NL-4AFA-B D4NL-4AFG-B D4NL-4BFA-B D4NL-4BFG-B D4NL-4CFA-B picture

Omron Switch Module D4NL-4AFA-B D4NL-4AFG-B D4NL-4BFA-B D4NL-4BFG-B D4NL-4CFA-B

$91.15



1pcs New AB isolating switch 194E-E63-1753 in box picture

1pcs New AB isolating switch 194E-E63-1753 in box

$308.00



New Honeywell LSA1A Switch Heavy Duty Limit Switch picture

New Honeywell LSA1A Switch Heavy Duty Limit Switch

$102.99



ELECTRIC COOLING FAN GROUND-ING THERMO-STAT SWITCH RADIATOR TEMP-ERATURE SENSOR picture

ELECTRIC COOLING FAN GROUND-ING THERMO-STAT SWITCH RADIATOR TEMP-ERATURE SENSOR

$19.95



Generac PWRcell CXSW200A3 Automatic Transfer Switch NEW -- Free Returns picture

Generac PWRcell CXSW200A3 Automatic Transfer Switch NEW -- Free Returns

$629.00







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