cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: [CB-4521] Fix geolocation not working after a page change.
Date Tue, 13 Aug 2013 15:55:55 GMT
Updated Branches:
  refs/heads/dev 10e2ee277 -> 08fd6f8fa


[CB-4521] Fix geolocation not working after a page change.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/08fd6f8f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/08fd6f8f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/08fd6f8f

Branch: refs/heads/dev
Commit: 08fd6f8fafc386963946ad2172ef158119e68272
Parents: 10e2ee2
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Aug 13 11:55:18 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Aug 13 11:55:18 2013 -0400

----------------------------------------------------------------------
 src/android/GeoBroker.java | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/08fd6f8f/src/android/GeoBroker.java
----------------------------------------------------------------------
diff --git a/src/android/GeoBroker.java b/src/android/GeoBroker.java
index 38603df..ea0ad1c 100755
--- a/src/android/GeoBroker.java
+++ b/src/android/GeoBroker.java
@@ -41,12 +41,6 @@ public class GeoBroker extends CordovaPlugin {
     private LocationManager locationManager;    
 
     /**
-     * Constructor.
-     */
-    public GeoBroker() {
-    }
-
-    /**
      * Executes the request and returns PluginResult.
      *
      * @param action 		The action to execute.
@@ -55,14 +49,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);


Mime
View raw message