mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
Backporting CB-4521
This commit is contained in:
parent
0e9b446a81
commit
cb11486f66
@ -55,14 +55,18 @@ public class GeoBroker extends CordovaPlugin {
|
||||
* @return True if the action was valid, or false if not.
|
||||
*/
|
||||
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
||||
if (this.locationManager == null) {
|
||||
this.locationManager = (LocationManager) this.cordova.getActivity().getSystemService(Context.LOCATION_SERVICE);
|
||||
this.networkListener = new NetworkListener(this.locationManager, this);
|
||||
this.gpsListener = new GPSListener(this.locationManager, this);
|
||||
if (locationManager == null) {
|
||||
locationManager = (LocationManager) this.cordova.getActivity().getSystemService(Context.LOCATION_SERVICE);
|
||||
}
|
||||
|
||||
if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ||
|
||||
locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER )) {
|
||||
if (networkListener == null) {
|
||||
networkListener = new NetworkListener(locationManager, this);
|
||||
}
|
||||
if (gpsListener == null) {
|
||||
gpsListener = new GPSListener(locationManager, this);
|
||||
}
|
||||
|
||||
if (action.equals("getLocation")) {
|
||||
boolean enableHighAccuracy = args.getBoolean(0);
|
||||
|
Loading…
Reference in New Issue
Block a user