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


1pcs used TSXMFPP128K Memory Card picture

1pcs used TSXMFPP128K Memory Card

$175.00



ABB Memory Expansion Board DSQC 318 3HAB2221-1 picture

ABB Memory Expansion Board DSQC 318 3HAB2221-1

$174.95



Fanuc Memory Card A20B-3900-0014/02A picture

Fanuc Memory Card A20B-3900-0014/02A

$199.95



Fanuc Bubble Memory Board BMU 64-2 A87L-0001-0016/09F *Tested* picture

Fanuc Bubble Memory Board BMU 64-2 A87L-0001-0016/09F *Tested*

$179.95



NEW Mitsubishi A1SNMCA-8KE Memory Cassette picture

NEW Mitsubishi A1SNMCA-8KE Memory Cassette

$151.62



Argolladora We R Memory Keepers Heidi Swapp Cinch Binding Machine 71050-9 by AC picture

Argolladora We R Memory Keepers Heidi Swapp Cinch Binding Machine 71050-9 by AC

$79.99







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