aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-05-05 22:00:00 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2011-05-12 18:08:49 +0200
commitd7f90eb9b2dbf0e3b9bae8cbea6ea0a1f658352c (patch)
tree79a29b4828b8184549629ab4672de35866256ad9 /src
parent097df1246e0f5e3f03bf0495ddd776cfe1943395 (diff)
downloadBlueGPS-d7f90eb9b2dbf0e3b9bae8cbea6ea0a1f658352c.zip
BlueGPS-d7f90eb9b2dbf0e3b9bae8cbea6ea0a1f658352c.tar.gz
BlueGPS-d7f90eb9b2dbf0e3b9bae8cbea6ea0a1f658352c.tar.bz2
try to remove mock provider before adding the new one
If there is already a mock provider with the same name as the one we are trying to add it will fail, so I now try to remove the provider (if it exists) before adding the new one.
Diffstat (limited to 'src')
-rw-r--r--src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
index ae8534e..3b98530 100644
--- a/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
+++ b/src/org/broeuschmeul/android/gps/nmea/util/NmeaParser.java
@@ -87,7 +87,13 @@ public class NmeaParser {
prov = lm.getProvider(mockLocationProvider);
if (prov != null){
Log.v(LOG_TAG, "Mock provider: "+prov.getName()+" "+prov.getPowerRequirement()+" "+prov.getAccuracy()+" "+lm.isProviderEnabled(mockLocationProvider));
+ try {
+ lm.removeTestProvider(mockLocationProvider);
+ } catch (IllegalArgumentException e){
+ Log.d(LOG_TAG, "unable to remove current provider Mock provider: "+mockLocationProvider);
+ }
}
+ prov = lm.getProvider(mockLocationProvider);
lm.addTestProvider(mockLocationProvider, false, true,false, false, true, true, true, Criteria.POWER_MEDIUM, Criteria.ACCURACY_FINE);
if ( force
|| (prov == null)