I have only one device (HTC HD Deside) for testing my apps and when I want to get GPS data with
locationManager.requestLocationUpdate(criteria,0,0,this); //critera = "gps"
My GPS icon appears in the notification bar but it "flashes", as if It meant my device is looking for and get the GPS data. Accordingly, my apps takes too much "thinking" times before it succeeds to get data from GPS (~1mn to 3mn !) (before the icon stop flashes)
So, I'm obliged to create a while instruction like this :
do{
lastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
}while(System.currentTimeMillis() - lastLocation.getTime() > 5000);
Thanks that, I'm sure to get a recently location but I lost too much time.
What's the problem? is it the hardware? Can I find a better way for fix this? Can I get "quickly" the GPS data? :/ (1~5 sec)
I think you should read this http://developer.android.com/guide/topics/location/strategies.html guide prior developing an location aware app.
The GPS sensor needs 1 to 3 minutes to get a fix, you can't have a very quick fix(1-5 seconds as you want).
You should use the last known location value and start requesting location fixes. When you have one, you refresh your content accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With