mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge pull request #176 from misaochan/illegal-arg-exception
Catch Illegal Argument Exceptions
This commit is contained in:
commit
a7427f21bf
1 changed files with 8 additions and 4 deletions
|
|
@ -57,10 +57,14 @@ public class GPSExtractor {
|
|||
provider = locationManager.getBestProvider(criteria, true);
|
||||
myLocationListener = new MyLocationListener();
|
||||
|
||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||
Location location = locationManager.getLastKnownLocation(provider);
|
||||
if (location != null) {
|
||||
myLocationListener.onLocationChanged(location);
|
||||
try {
|
||||
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
|
||||
Location location = locationManager.getLastKnownLocation(provider);
|
||||
if (location != null) {
|
||||
myLocationListener.onLocationChanged(location);
|
||||
}
|
||||
} catch (IllegalArgumentException e){
|
||||
Log.e(TAG, "Illegal argument exception", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue