summaryrefslogtreecommitdiff
path: root/altosdroid
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-04-11 22:39:14 -0700
committerKeith Packard <keithp@keithp.com>2013-04-11 22:39:14 -0700
commit9a8cc23de5776ea3fa2bdc96cbe63422eb555d63 (patch)
treeef2b6442b04a4507ac3da4a38c6705c4dbee8823 /altosdroid
parent83ce46c73b0e876f9f630943af19ea97b3a21d3c (diff)
altosdroid: Mike was right -- only need one LocationListener
I mis-read the docs and thought we needed two listeners, one for GPS and one for network position. Looks like we don't Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosdroid')
-rw-r--r--altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
index 98b7d32f..e6854585 100644
--- a/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
+++ b/altosdroid/src/org/altusmetrum/AltosDroid/TelemetryService.java
@@ -46,7 +46,6 @@ import org.altusmetrum.altoslib_1.*;
class AltosLocationListener implements LocationListener {
TelemetryService service;
- boolean fine;
public void onLocationChanged(Location location) {
service.sendLocation(location);
@@ -61,8 +60,7 @@ class AltosLocationListener implements LocationListener {
public void onProviderDisabled(String provider) {
}
- public AltosLocationListener(TelemetryService service, boolean fine) {
- this.fine = fine;
+ public AltosLocationListener(TelemetryService service) {
this.service = service;
}
}
@@ -112,8 +110,7 @@ public class TelemetryService extends Service {
// location listeners
- private AltosLocationListener gpsListener;
- private AltosLocationListener netListener;
+ private AltosLocationListener locationListener;
// Last data seen; send to UI when it starts
@@ -311,13 +308,12 @@ public class TelemetryService extends Service {
timer.scheduleAtFixedRate(new TimerTask(){ public void run() {onTimerTick();}}, 10000L, 10000L);
// Listen for GPS and Network position updates
- gpsListener = new AltosLocationListener(this, true);
- netListener = new AltosLocationListener(this, false);
+ locationListener = new AltosLocationListener(this);
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
- locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, gpsListener);
- locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, netListener);
+ locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
+ locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
}
@Override
@@ -352,8 +348,7 @@ public class TelemetryService extends Service {
// Stop listening for location updates
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
- locationManager.removeUpdates(gpsListener);
- locationManager.removeUpdates(netListener);
+ locationManager.removeUpdates(locationListener);
// Stop the bluetooth Comms threads
stopAltosBluetooth();