You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/10/16 20:44:35 UTC
android commit: Backporting CB-4521
Updated Branches:
refs/heads/2.9.x 0e9b446a8 -> cb11486f6
Backporting CB-4521
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/cb11486f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/cb11486f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/cb11486f
Branch: refs/heads/2.9.x
Commit: cb11486f66884fe91ed6c98567a06fff69d0eb66
Parents: 0e9b446
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Oct 16 11:44:21 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Oct 16 11:44:21 2013 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/GeoBroker.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/cb11486f/framework/src/org/apache/cordova/GeoBroker.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GeoBroker.java b/framework/src/org/apache/cordova/GeoBroker.java
index 4a07b73..ca86a31 100644
--- a/framework/src/org/apache/cordova/GeoBroker.java
+++ b/framework/src/org/apache/cordova/GeoBroker.java
@@ -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);