Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force GPS provider to get speed in android?

Tags:

android

gps

I want speed factor in my GPS application in android. I want to use both network provider and gps provider both to get location updates. But network provider hardly gives speed. While GPS provider provides fix many a times.

  1. But is it so that once a fix is found without speed, device will not request for new update until the interval or distance set in requestLocationUpdates changes ? If so, how can I enforce to continue it until I have speed. I found Criteria class, but we can use it only while choosing a provider. I want to use it while obtaining fix. Can I ?

  2. Another thing I noticed is sometimes I get speed to be 127 m/s at start, even I am steady then it normalizes to actual speed. Is this a problem of device (tested in G1), or is in general depending on satallite or location ?

  3. Does using Criteria while choosing provider, will not provide me location points that do not fit it ? Like if I set criteriaObj.setSpeedRequired(true) , then will I not get points if there is not such availble. As I require position update in any case.

Any suggestions ?

like image 318
Pritam Avatar asked Aug 08 '10 10:08

Pritam


People also ask

How will you initiate location manager object?

First, create a Location Manager object by calling the getSystemService() method and LOCATION_SERVICE as an argument. Call getBestProvider() to get the location in the form of a string. Now the provider to getLastKnownLocation() as an argument to get the location.


1 Answers

Answering my old question ..

  1. To request continous updates you need to set min distance and min update time as zero. This will however drain the device battery faster, but you are sure you get the best from GPS hardware and filter out your conditions.

  2. This 127 m/s^2 is indeed a bug in android. After reviewing the code of Google's mytracks GPS app, I found it has bee noted and filtered this special case of 127 in their code itself !

  3. Yes you will not get points that do not have speed.

like image 130
Pritam Avatar answered Sep 25 '22 18:09

Pritam