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


LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter picture

LCD Digital Multimeter Voltmeter Ammeter Ohmmeter Volt AC DC Tester Leads Meter

$9.95



US Stock DC -100A ~ +100A Analog AMP Current Needle Panel Meter Ammeter & Shunt picture

US Stock DC -100A ~ +100A Analog AMP Current Needle Panel Meter Ammeter & Shunt

$21.33



US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-100A DC & Shunt picture

US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-100A DC & Shunt

$18.98



DC 100A 100V Voltmeter Ammeter Volt Amp Meter Voltage Current Tester with Shunt picture

DC 100A 100V Voltmeter Ammeter Volt Amp Meter Voltage Current Tester with Shunt

$12.99



US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-200A DC & Shunt picture

US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-200A DC & Shunt

$18.91



US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-10A DC picture

US Stock Analog Panel AMP Current Ammeter Meter Gauge DH-670 0-10A DC

$13.23







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