forked from github/cordova-android
GeoBroker checks if location service avialable for device first.
This commit is contained in:
parent
c52dc10c9e
commit
e575212c49
@ -59,9 +59,14 @@ public class GeoBroker extends Plugin {
|
||||
this.networkListener = new NetworkListener(this.locationManager, this);
|
||||
this.gpsListener = new GPSListener(this.locationManager, this);
|
||||
}
|
||||
|
||||
PluginResult.Status status = PluginResult.Status.NO_RESULT;
|
||||
String message = "";
|
||||
String message = "Location API is not available for this device.";
|
||||
PluginResult result = new PluginResult(status, message);
|
||||
|
||||
if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ||
|
||||
locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER )) {
|
||||
|
||||
result.setKeepCallback(true);
|
||||
|
||||
try {
|
||||
@ -88,7 +93,9 @@ public class GeoBroker extends Plugin {
|
||||
} catch (JSONException e) {
|
||||
result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private void clearWatch(String id) {
|
||||
|
Loading…
Reference in New Issue
Block a user