1

I tried to get the GPS latitude and longitude values using Autonomous and CellSite Mode in parallel using two threads, but while execution only one thread is being active and I get values from only that, the other thread doesn't return any values at all.

Is it possible to retrieve the GPS information using multiple threads running in parallel and also can I display the latitude and longitude values from the threads on the screen with less accuracy rate among the values?

gnat
  • 6,213
  • 108
  • 53
  • 73
su.kumar
  • 41
  • 1
  • 2
    Just curious, why do you want two separate threads simultaneously trying to acquire a location fix? You don't have to answer that if you don't like ... I'm just curious. What would help us, however, is if you could post the code you're using for this. – Nate Jul 10 '12 at 21:15
  • I want to get the GPS fix indoors also but in Autonomous mode I'm unable to get a fix inside a building. So the thread running with CellSite mode gives me the fix and I would display that. But parallelly when I'm outdoors or the thread running using Autonomous mode gives me a fix I will compare the accuracy of both fixes and display the more accurate fix. – su.kumar Jul 11 '12 at 04:55
  • can you show us the code you're using to create your threads, and start searching for location fixes in each thread? – Nate Jul 11 '12 at 07:32
  • public class GetGPS extends Thread{ – su.kumar Jul 11 '12 at 08:43
  • 2
    You can **edit** your original question above, and post the code in there. then, use the **{ }** button to format it as code. that works better than trying to put it into comments. – Nate Jul 11 '12 at 08:45

2 Answers2

1

It is certainly possable to get fixes in two threads, at least in separate applications contexts. I've never tried to do that in one application. As Nate implied, I can't think of a use case.

All that said, I suspect that the OS would satisfy both requests from one underlying thread that meets or exceeds the specifications of each request.

Richard
  • 8,920
  • 2
  • 18
  • 24
  • In my experience, BBs having GPS don't have cellsite provider, and the opposite is usually true as well. – Mister Smith Jul 11 '12 at 13:03
  • That changes as you progress up the the OS levels. – Richard Jul 11 '12 at 13:33
  • I'm not so sure about that. It is true that I usually run the tests on european GSM BBs, which theoretically don't have cellsite provider since it is only available for CDMA devices. But some cheap 8520 do have this provider. In my case, tested from OS 5.0 to 7.1 and never found a device having both GPS and Cellsite. Maybe it is another story for american devices. – Mister Smith Jul 12 '12 at 07:58
  • This comment seems to be contradicted by your answer. The way I use the system when BlackBerryLocation is available is to set it up to provide the quickest first fix followed by GPS fixes. The first fix may come from the GPS if it is already running, or from one of the GEOLOCATION sources which includes Cellsite. – Richard Jul 12 '12 at 12:14
  • What i meant in my answer is that cellsite provider returns so fast that using a thead is not worth it. I usually want to get GPS locations first, then cellsite as fallback. I know probably I won't get cellsite if GPS provider is available, but anyway I try. – Mister Smith Jul 12 '12 at 13:19
0

IMHO, spawning a thread to retrieve Cellsite-based location is a waste of resources, since it takes less than a second to retrieve it (when cellsite provider is available). Otherwise it is not available no matter how much you wait.

Usually, for location purposes, you just need a fix as accurate as possible. You could instantiate a BlackBerrycriteria and set its fields to try to use GPS provider in first place, and if not available, switch to cellsite provider as fallback mechanism.

Mister Smith
  • 27,417
  • 21
  • 110
  • 193