heprelude / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

IllegalArgumentException: provider=gps in LocationUtils.getLastKnownLocation #472

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
LocationManager.getLastKnownLocation throws IllegalArgumentException if 
provider doesn't exist.

LocationUtils.getLastKnownLocation should only check for gps and network if 
they exist.

Original issue reported on code.google.com by neilboyd on 1 Sep 2013 at 8:49

GoogleCodeExporter commented 8 years ago
I can think of two ways of doing this. I don't know which is best:

1. Check if getProvider returns not null.
2. Check if isProviderEnabled returns true.

Original comment by neilboyd on 1 Sep 2013 at 8:50

GoogleCodeExporter commented 8 years ago
I chose option 2 to be consistent with 
GpsMyLocationProvider.startLocationProvider which only checks enabled providers.

I couldn't reproduce because the devices I tried it on just returned null.

Original comment by neilboyd on 2 Sep 2013 at 8:27

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1300.

Original comment by neilboyd on 2 Sep 2013 at 8:29