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


49' FT 6/4 SOOW High Flexible Portable Power Cable Jacket Black 600V USA picture

49' FT 6/4 SOOW High Flexible Portable Power Cable Jacket Black 600V USA

$152.95



104050 50' 10/4 SOOW Wire Cord Cable Portable Power 10 Gauge 4 Conductor picture

104050 50' 10/4 SOOW Wire Cord Cable Portable Power 10 Gauge 4 Conductor

$147.18



84025 25' 8/4 SOOW Wire Cord Cable Portable Power 8 Gauge 4 Conductor picture

84025 25' 8/4 SOOW Wire Cord Cable Portable Power 8 Gauge 4 Conductor

$98.60



Velvac 050019 12 Awg 7 Conductor Stranded Trailer Cable 100 Ft. Bk picture

Velvac 050019 12 Awg 7 Conductor Stranded Trailer Cable 100 Ft. Bk

$370.99



Conductor Bus p/n 3536830-801 picture

Conductor Bus p/n 3536830-801

$285.00



12/2 UF-B Wire, Underground Feeder and Direct Earth Burial Cable 250’ picture

12/2 UF-B Wire, Underground Feeder and Direct Earth Burial Cable 250’

$170.00







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