aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/broeuschmeul/android/gps/bluetooth/provider
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/broeuschmeul/android/gps/bluetooth/provider')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java19
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java1
2 files changed, 19 insertions, 1 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index b233168..3d2d0a8 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -456,11 +456,28 @@ public class BlueetoothGpsManager {
* @see NmeaParser#enableMockLocationProvider(java.lang.String)
* @param gpsName the name of the Location Provider to use for the bluetooth GPS
+ * @param force true if we want to force auto-activation of the mock location provider (and bypass user preference).
+ */
+ public void enableMockLocationProvider(String gpsName, boolean force){
+ if (parser != null){
+ Log.d(LOG_TAG, "enabling mock locations provider: "+gpsName);
+ parser.enableMockLocationProvider(gpsName, force);
+ }
+ }
+
+ /**
+ * Enables the Mock GPS Location Provider used for the bluetooth GPS.
+ * In fact, it delegates to the NMEA parser.
+ *
+ * @see NmeaParser#enableMockLocationProvider(java.lang.String)
+
+ * @param gpsName the name of the Location Provider to use for the bluetooth GPS
*/
public void enableMockLocationProvider(String gpsName){
if (parser != null){
Log.d(LOG_TAG, "enabling mock locations provider: "+gpsName);
- parser.enableMockLocationProvider(gpsName);
+ boolean force = sharedPreferences.getBoolean(BluetoothGpsProviderService.PREF_FORCE_ENABLE_PROVIDER, false);
+ parser.enableMockLocationProvider(gpsName, false);
}
}
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 49e0f34..a0ef34c 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -64,6 +64,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
public static final String PREF_START_GPS_PROVIDER = "startGps";
public static final String PREF_GPS_LOCATION_PROVIDER = "gpsLocationProviderKey";
public static final String PREF_REPLACE_STD_GPS = "replaceStdtGps";
+ public static final String PREF_FORCE_ENABLE_PROVIDER = "forceEnableProvider";
public static final String PREF_MOCK_GPS_NAME = "mockGpsName";
public static final String PREF_CONNECTION_RETRIES = "connectionRetries";
public static final String PREF_TRACK_RECORDING = "trackRecording";