Dbrunet / android-protips-location

Automatically exported from code.google.com/p/android-protips-location
0 stars 0 forks source link

Should use Criteria.ACCURACY_COARSE instead of Criteria.ACCURACY_LOW in setAccuracy #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
  Hi Reto,

Thanks for your example project !

It looks like the methode Criteria.setAccuracy does accept only:
Criteria.NO_REQUIREMENT = 0
Criteria.ACCURACY_FINE = 1
Criteria.ACCURACY_COARSE = 2

But in the 'GingerbreadLastLocationFinder' class, you use:
criteria.setAccuracy(Criteria.ACCURACY_LOW);

Criteria.ACCURACY_LOW = 1, the same than Criteria.ACCURACY_FINE !!!

It should be
criteria.setAccuracy(Criteria.ACCURACY_COARSE)

Even worst, setting criteria.setAccuracy(Criteria.ACCURACY_HIGH); throw an 
exception since Criteria.ACCURACY_HIGH (3) > Criteria.ACCURACY_COARSE (2)...

Maybe the Criteria constants should be set as enum or renamed, or something 
else to not be misused...

Thanks,
Seb.

Original issue reported on code.google.com by sebastie...@gmail.com on 28 Jun 2011 at 8:17

GoogleCodeExporter commented 8 years ago
so accuracy_course is the 1 to use to get correct info and better speed an 
accuracy? lemme know 
summer
thx

Original comment by paralega...@gmail.com on 15 Jul 2011 at 9:53

GoogleCodeExporter commented 8 years ago
I agree. This looks like a bug.

Original comment by cow...@bbs.darktech.org on 12 May 2012 at 10:40

GoogleCodeExporter commented 8 years ago
This looks like a bug.
Log:
 > java.lang.IllegalArgumentException: accuracy=3
 > at android.location.Criteria.setAccuracy(Criteria.java:223)
 > ...

Original comment by Jet...@gmail.com on 23 Oct 2013 at 7:31