cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [13/17] git commit: Code clean-up for android src.
Date Thu, 05 Dec 2013 00:58:45 GMT
Code clean-up for android src.


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/f83af097
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/f83af097
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/f83af097

Branch: refs/heads/master
Commit: f83af097412970d9f0fe3bccfe0a69001c29c6aa
Parents: 8acd22d
Author: Archana Naik <naika@lab126.com>
Authored: Mon Nov 11 13:17:55 2013 -0800
Committer: Archana Naik <naika@lab126.com>
Committed: Mon Nov 11 13:17:55 2013 -0800

----------------------------------------------------------------------
 src/android/CordovaLocationListener.java | 3 +--
 src/android/GPSListener.java             | 3 +--
 src/android/GeoBroker.java               | 6 +++---
 3 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/f83af097/src/android/CordovaLocationListener.java
----------------------------------------------------------------------
diff --git a/src/android/CordovaLocationListener.java b/src/android/CordovaLocationListener.java
index b60bf59..f0f70fe 100755
--- a/src/android/CordovaLocationListener.java
+++ b/src/android/CordovaLocationListener.java
@@ -31,7 +31,6 @@ import android.location.Location;
 import android.location.LocationListener;
 import android.location.LocationManager;
 import android.os.Bundle;
-import android.os.Looper;
 import android.util.Log;
 
 public class CordovaLocationListener implements LocationListener {
@@ -199,7 +198,7 @@ public class CordovaLocationListener implements LocationListener {
         if (!this.running) {
             if (this.locationManager.getProvider(LocationManager.NETWORK_PROVIDER) != null)
{
                 this.running = true;
-                this.locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
60000, 10, Looper.getMainLooper());
+                this.locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
60000, 10, this);
             } else {
                 this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "Network provider
is not available.");
             }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/f83af097/src/android/GPSListener.java
----------------------------------------------------------------------
diff --git a/src/android/GPSListener.java b/src/android/GPSListener.java
index 1b156d5..468913a 100755
--- a/src/android/GPSListener.java
+++ b/src/android/GPSListener.java
@@ -19,7 +19,6 @@
 
 package org.apache.cordova.geolocation;
 
-import android.os.Looper;
 import android.location.LocationManager;
 
 /**
@@ -42,7 +41,7 @@ public class GPSListener extends CordovaLocationListener {
         if (!this.running) {
             if (this.locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) {
                 this.running = true;
-                this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
60000, 0, Looper.getMainLooper());
+                this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
60000, 0, this);
             } else {
                 this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "GPS provider is
not available.");
             }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/f83af097/src/android/GeoBroker.java
----------------------------------------------------------------------
diff --git a/src/android/GeoBroker.java b/src/android/GeoBroker.java
index dc836d9..fee990c 100755
--- a/src/android/GeoBroker.java
+++ b/src/android/GeoBroker.java
@@ -66,7 +66,7 @@ public class GeoBroker extends CordovaPlugin {
                 boolean enableHighAccuracy = args.getBoolean(0);
                 int maximumAge = args.getInt(1);
 
-                Location last = this.locationManager.getLastKnownLocation(enableHighAccuracy
? LocationManager.GPS_PROVIDER: LocationManager.NETWORK_PROVIDER);
+                Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy
? LocationManager.GPS_PROVIDER: LocationManager.NETWORK_PROVIDER));
                 // Check if we can use lastKnownLocation to get a quick reading and use less
battery
                 if (last != null && (System.currentTimeMillis() - last.getTime())
<= maximumAge) {
                     PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
@@ -102,7 +102,7 @@ public class GeoBroker extends CordovaPlugin {
     }
 
     private void getCurrentLocation(CallbackContext callbackContext, boolean enableHighAccuracy,
int timeout) {
-        if (enableHighAccuracy && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
{
+        if (enableHighAccuracy) {
             this.gpsListener.addCallback(callbackContext, timeout);
         } else {
             this.networkListener.addCallback(callbackContext, timeout);
@@ -110,7 +110,7 @@ public class GeoBroker extends CordovaPlugin {
     }
 
     private void addWatch(String timerId, CallbackContext callbackContext, boolean enableHighAccuracy)
{
-        if (enableHighAccuracy && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
{
+        if (enableHighAccuracy) {
             this.gpsListener.addWatch(timerId, callbackContext);
         } else {
             this.networkListener.addWatch(timerId, callbackContext);


Mime
View raw message