BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-23-2010, 11:38 AM   #1
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default Capturing location information is not working inside building

Please Login to Remove!

This application works perfect in the simulator. It also works if the device is put outside the building.
But not working inside the building.

I found that BlackBerryCriteria() constructor sets the GPS mode in the following order: Autonomous, Assisted, Cellsite mode.

But in my case only Autonomous is working. If Autonomous is not available, I need to switch to Assisted or Cellsite mode.

My understanding on GPSInfo.isGPSModeAvailable() is, it only checks whether the mode is supported on blackberry device, right?

I need someone's help to solve this problem.
Here's my code snippets

Code:
public void setNewLocation() {
		Thread t = new Thread(new Runnable() {
			public void run() {
				try {
					BlackBerryCriteria criteria = new BlackBerryCriteria();
				
					criteria.setCostAllowed(true);
					criteria.setPreferredPowerConsumption(BlackBerryCriteria.POWER_USAGE_MEDIUM);
					criteria.setHorizontalAccuracy(BlackBerryCriteria.NO_REQUIREMENT);
					criteria.setVerticalAccuracy(BlackBerryCriteria.NO_REQUIREMENT);
					criteria.setGPSRestartInterval(120, 3);

					BlackBerryLocationProvider locProvider = (BlackBerryLocationProvider) 								LocationProvider.getInstance(criteria);
					if(locProvider!=null){
					locProvider.setLocationListener(new MyLocationListener(),
							30, 15, 15);
					}

				} catch (Exception e) {
					addErrorQueue(e.getMessage());
				}
			}
		});
		t.start();
	}
And the listener code is
Code:
public class MyLocationListener implements LocationListener {
	public void locationUpdated(LocationProvider provider, Location myLocation) {
		if (myLocation instanceof BlackBerryLocation) {
				if (myLocation.isValid()) {
					BlackBerryLocation location = (BlackBerryLocation) myLocation;
					try {
						QualifiedCoordinates qc = location.getQualifiedCoordinates();
						double lat = qc.getLatitude();
						double lon = qc.getLongitude(); 
						float heading = location.getCourse();
						float speed = location.getSpeed(); 
						int satellites = location.getSatelliteCount();
						addLocationQueue(new MyLocation(........));

					} catch (Exception ex) {
						addErrorQueue(ex.getMessage());
					}
				}
				else
				{
					addErrorQueue("Invalid location");
				}
		} 
	}

	public void providerStateChanged(LocationProvider provider, int newState) {
		
	}
}

Last edited by romah; 11-23-2010 at 11:40 AM..
Offline  
Old 11-23-2010, 12:18 PM   #2
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default Re: Capturing location information is not working inside building

I tried with this code and it works perfect for the first time inside the building also. That means it captures the location for the first time.
But it doesnot work for another time interval. It throws timeout exception, then terminates the process. What am I doing wrong?

Code:
if (GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_CELLSITE)) {
	criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);			
             criteria.setFailoverMode(GPSInfo.GPS_MODE_ASSIST, 2, 60);
	criteria.setSubsequentMode(GPSInfo.GPS_MODE_ASSIST);
	} else if (GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_ASSIST)) {
		criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_ASSIST);
		criteria.setFailoverMode(GPSInfo.GPS_MODE_AUTONOMOUS,1, 30);
		criteria.setSubsequentMode(GPSInfo.GPS_MODE_AUTONOMOUS);
	           } else if (GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_AUTONOMOUS)) {
			criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
			criteria.setFailoverMode(GPSInfo.GPS_MODE_AUTONOMOUS,1, 30);
			criteria.setSubsequentMode(GPSInfo.GPS_MODE_AUTONOMOUS);
			}

Last edited by romah; 11-23-2010 at 12:22 PM..
Offline  
Old 11-29-2010, 11:55 AM   #3
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default Re: Capturing location information is not working inside building

Please someone help me to capture the location information inside the building and also handle the exception when timeout.

Here is the message:
"Uncaught exception: Application My_GPS_Test (223) is not responding: process terminated."

And the code:
Code:
try {
	BlackBerryCriteria criteria = new BlackBerryCriteria();
				
	BlackBerryCriteria criteria = new BlackBerryCriteria(gpsMode);

	criteria.setPreferredResponseTime(BlackBerryCriteria.NO_REQUIREMENT);
	criteria.setCostAllowed(true);

	if (gpsMode == GPSInfo.GPS_MODE_AUTONOMOUS) {
		criteria.setCostAllowed(false);
	} else if (gpsMode == GPSInfo.GPS_MODE_ASSIST) {
		criteria.setPreferredPowerConsumption(BlackBerryCriteria.POWER_USAGE_MEDIUM);
		} else {
			criteria.setPreferredPowerConsumption(BlackBerryCriteria.POWER_USAGE_LOW);
			}

	try {
		locationProvider = LocationProvider.getInstance(criteria);
		if (locationProvider != null) {
			locationProvider.setLocationListener(
				new MyLocationListener(), -1, -1, -1);
			}
				
	} catch (LocationException ex) {
		addErrorQueue(ex.getMessage());
		}

} catch(UnsupportedOperationException e) {
	addErrorQueue(e.getMessage());
}

Last edited by romah; 11-29-2010 at 11:57 AM..
Offline  
Old 11-29-2010, 02:27 PM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Re: Capturing location information is not working inside building

This error: Uncaught exception: Application My_GPS_Test (223) is not responding: process terminated

...indicates that you are performing a blocking operation in the event thread. Blocking operations (like GPS or communications) should be performed in a separate worker thread. If you block the event thread, the system will terminate your process (with this error) as soon as the event queue fills up.
Offline  
Old 11-29-2010, 02:55 PM   #5
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default Re: Capturing location information is not working inside building

I am running this setLocation() method in separate thread once it is called. My timer thread only checks the errorQueue and locationQueue. If there are items in queues, the timer thread sends them to the database server.

Dougsg38p, which one will be the blocking operation in my code above? This exception only pop-ups when the device is inside the building. Otherwise, it works perfect outside the building. i.e., application works perfect if the device is line-of-sight with satellites.
Offline  
Old 11-29-2010, 06:09 PM   #6
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default Re: Capturing location information is not working inside building

The longer you block the event thread, the more likely that you will get an overflow and hence the exception. This would why you get away with it in the case where the GPS works quickly, but it fails where the GPS hangs for a long time.

Obviously, you are blocking somewhere. I don't see this in the last code snippet, but it doesn't really show me enough to make a determination.
Offline  
Old 12-01-2010, 04:22 PM   #7
romah
Knows Where the Search Button Is
 
Join Date: Jun 2010
Model: 8530
PIN: N/A
Carrier: Sprint
Posts: 48
Default Re: Capturing location information is not working inside building

If there is no satellite coverage (i.e. inside a building), how to switch the mode into Cellsite (i.e., cell triangulation).
And if there is satellite coverage comes back (i.e., outside the building), how to switch back to autonomous mode.

I tried like this but not worked.

Code:
criteria.setMode(GPSInfo.GPS_MODE_AUTONOMOUS);
criteria.setFailoverMode(GPSInfo.GPS_MODE_AUTONOMOUS, 1, 30);
criteria.setSubsequentMode(GPSInfo.GPS_MODE_CELLSITE);
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

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

Forum Jump

Similar Threads for: Capturing location information is not working inside building
Thread Thread Starter Forum Replies Last Post
Signal Location utility for Blackberry BETA... RemyJ Aftermarket Software 425 10-17-2010 11:44 AM
Location Based Services (LBS) otherwise known as GPS Policies TargetIT BES Admin Corner 5 01-12-2009 08:54 AM
Sync Error....What could it be? kurrupt_1 General 8300 Series Discussion - Curve 7 11-22-2007 07:41 PM
7100I Big HELP whoknowswhat General Legacy Device Discussion 1 10-23-2005 03:45 PM


Schneider Electric Energy Server EBX510 Server For Energy Management- picture

Schneider Electric Energy Server EBX510 Server For Energy Management-

$4350.00



Wittmann Material Conveyance System Line Server picture

Wittmann Material Conveyance System Line Server

$550.00



SERVER TECHNOLOGY 4870-XLS-44 SENTRY VDC 48VOLT DC REMOTE POWER MANAGER picture

SERVER TECHNOLOGY 4870-XLS-44 SENTRY VDC 48VOLT DC REMOTE POWER MANAGER

$299.99



MEDIA SERVER DOLBY IMS2000 MSIP-REM-DIB-IMS2000 picture

MEDIA SERVER DOLBY IMS2000 MSIP-REM-DIB-IMS2000

$799.99



Axis Q7900 14 Slot Video Server Rack Chassis,Axis 0287-004 picture

Axis Q7900 14 Slot Video Server Rack Chassis,Axis 0287-004

$230.00



MOXA CN2650-16-2AC 16-Port Mountable Async Terminal Server Dual Lan Ports picture

MOXA CN2650-16-2AC 16-Port Mountable Async Terminal Server Dual Lan Ports

$285.00







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