01-18-2011 08:11 AM
Hey fellows, I need your help.
I've done one or two applications that use GPS until now. All of them work, but they're a little inconstant in this matter.
Now I'm working on a new one and I'm having troubles to make it work in the costumer's BB.
I am testing in a Curve 8310, which works quite well, and the custumer is trying in a Curve and a Bold devices (don't know exactly which model). He uses other applications like GoogleMaps (I dont have a clue of how do they get the user location so well) and foursquare, and they work well with the GPS.
I'm aiming for the 4.2.1 OS version.
The method I am using to retrieve the Location is the following:
public static void getCoordinates() {
new Thread() {
public void run() {
try {
LocationProvider locationProvider = LocationProvider.getInstance(null);
Location location = locationProvider.getLocation(90);
longitude = location.getQualifiedCoordinates() .getLongitude();
latitude = location.getQualifiedCoordinates().getLatitude();
} catch (Exception e) {
// handle exception
}
}
}.start();
}
It's quite simple and I didn't find nothing much different from this anywhere else in my researchs.
I also tried to instantiate the LocationProvider with a Criteria but I think that doesn't makes much difference, since all I need is basic stuff, and most of it are already set by default.
Is there anything else I could do?
I read about the many types of location retrieval that exists as PDE, Cellsite, GPS, etc. But I don't care, I just want the lat and long, shouldn't it work that simple way, doesn't matter how? Or is this GPS thing something like the HttpConnection **bleep**, that we need to do everything by ourselves with a lot of workarounds?
I would really appreciate your help.
Thank you.
Rgs,
Dan
01-18-2011 01:25 PM
Now something strange happened.
I couldn't get my location through my application, then I opened the Blackberry Maps which found my location very fast. I went back to my application and voila, it started to get my location pretty fast also.
Was that a coincidence? Or the fact that I retrieved my location using the Blackberry Maps first trigered something that would make my app start working?
Anyone?
01-18-2011 03:35 PM
Google Maps uses Google's cell tower location database for a "first fix" - it is fast but not accurate.
You are requesting the "default"provider, which is likley going to be stand-alone mode on the devices you are looking at. This will take a long time (more than 90 seconds) if you are outside with a clear view to the sky, and it won't work at all if you are in a building.
01-18-2011 03:39 PM
Thank you very much for your answer RexDoug!
But what whould be the best approach for my case then?
I actually don't need accuracy for the apps I'm working on.What about the Blackberry Maps application? It is fast enough. Is it possible to do something like that?
Thanks!
Rgs,
Dan
11-01-2011 10:44 AM
Any updates on this thread.. I am facing a similar issue.
11-01-2011 06:41 PM
There is no simple answer to "why doesn't my GPS code work".
You'll need to be specific about the type of GPS method you are using, the carrier, and the device.
Also as stated above, if you are using autonomous mode, this won't work indoors.
If you are using network-assisted mode, you need to be cognizent of the support (or lack thereof) on your specific network.
Have you read all of the KB articles on the subject?