Differentiating between GPS provider unavailable and disabled - unavailable, in some implementations (such as Samsung's) just means it doesn't have a fix.

(Fixes issue 505)
This commit is contained in:
Rodrigo Damazio
2011-08-01 15:31:42 -03:00
parent 27734495f4
commit b16429f3f8
2 changed files with 10 additions and 3 deletions
@@ -24,7 +24,7 @@ import java.util.Set;
/**
* External data source manager, which converts system-level events into My Tracks data events.
*
*
* @author Rodrigo Damazio
*/
class DataSourceManager {
@@ -36,6 +36,7 @@ class DataSourceManager {
void notifyPointsUpdated();
void notifyPreferenceChanged(String key);
void notifyLocationProviderEnabled(boolean enabled);
void notifyLocationProviderAvailable(boolean available);
void notifyLocationChanged(Location loc);
void notifyHeadingChanged(float heading);
}
@@ -93,7 +94,7 @@ class DataSourceManager {
public void onStatusChanged(String provider, int status, Bundle extras) {
if (!LocationManager.GPS_PROVIDER.equals(provider)) return;
listener.notifyLocationProviderEnabled(status == LocationProvider.AVAILABLE);
listener.notifyLocationProviderAvailable(status == LocationProvider.AVAILABLE);
}
@Override
@@ -168,7 +169,7 @@ class DataSourceManager {
neededListeners.remove(ListenerDataType.SAMPLED_OUT_POINT_UPDATES);
neededListeners.add(ListenerDataType.POINT_UPDATES);
}
Log.d(TAG, "Updating internal listeners to types " + neededListeners);
// Unnecessary = registered - needed
@@ -129,6 +129,12 @@ public class TrackDataHub {
TrackDataHub.this.notifyFixType();
}
@Override
public void notifyLocationProviderAvailable(boolean available) {
hasFix = available;
TrackDataHub.this.notifyFixType();
}
@Override
public void notifyLocationChanged(Location loc) {
TrackDataHub.this.notifyLocationChanged(loc,