aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values-fr/strings.xml15
-rw-r--r--res/values/strings.xml17
-rw-r--r--res/xml/pref.xml6
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java11
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java5
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java4
6 files changed, 32 insertions, 26 deletions
diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml
index 6923da6..6cbb744 100644
--- a/res/values-fr/strings.xml
+++ b/res/values-fr/strings.xml
@@ -29,14 +29,12 @@
<string name="pref_replace_std_gps_summary_off">Un nouveau location provider sera utilisé</string>
<string name="pref_mock_gps_name_title">Nom du location provider</string>
<string name="pref_mock_gps_name_summary">Nom du GPS Bluetooth : %s</string>
+ <string name="pref_connection_retries_title">Nombre de connexions</string>
+ <string name="pref_connection_retries_summary">"Nombre d'essais avant fermeture : %s"</string>
<string name="pref_recording_title">Activer/Désactiver NMEA log</string>
<string name="pref_recording_summary_off">Enregistrement du GPS inactif</string>
<string name="pref_recording_summary_on">Enregistrement du GPS actif</string>
<string name="pref_recording_params_title">"Paramètres d'enregistrement"</string>
- <string name="pref_mintime_title">Intervalle de temps</string>
- <string name="pref_mintime_summary">Durée entre les données GPS en millisecondes</string>
- <string name="pref_mindistance_title">Intervalle de distance</string>
- <string name="pref_mindistance_summary">Distance entre les données GPS en metres</string>
<string name="pref_trackfile_prefix_title">Préfixe</string>
<string name="pref_trackfile_prefix_summary">Indiquer un préfixe pour les fichiers de traces</string>
<string name="pref_trackfile_directory_title">Dossier</string>
@@ -55,12 +53,9 @@
<string name="foreground_nmea_recording_started_notification">Enregistrement des données NMEA en cours.</string>
<string name="connection_problem_notification_title">BlueGps : problème de connexion</string>
<plurals name="connection_problem_notification">
- <item quantity="one">"encore un essai avant fermeture"</item>
- <item quantity="other">"encore %d essais avant fermeture"</item>
+ <item quantity="one">"Encore un essai avant fermeture"</item>
+ <item quantity="other">"Encore %d essais avant fermeture"</item>
</plurals>
- <!--
- <string name="connection_problem_notification">Have tried %d times - will retry %d more times</string>
- -->
<string name="service_closed_because_connection_problem_notification_title">BlueGps arrêté</string>
- <string name="service_closed_because_connection_problem_notification">Motif: problèmes de connexion avec le GPS</string>
+ <string name="service_closed_because_connection_problem_notification">Motif : problèmes de connexion</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6a6fea9..3da0241 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -24,13 +24,13 @@
<string name="pref_gps_location_provider_key">gpsLocationProviderKey</string>
<string name="pref_replace_std_gps_key">replaceStdtGps</string>
<string name="pref_mock_gps_name_key">mockGpsName</string>
+ <string name="pref_connection_retries_key">connectionRetries</string>
<string name="pref_recording_key">trackRecording</string>
<string name="pref_trackfile_directory_key">trackFileDirectory</string>
<string name="pref_trackfile_prefix_key">trackFilePrefix</string>
<string name="pref_bluetooth_device_key">bluetoothDevice</string>
- <string name="defaultTrackMinDistance">0.0</string>
- <string name="defaultTrackMinTime">0</string>
+ <string name="defaultConnectionRetries">5</string>
<string name="defaultTrackFileDirectory">/sdcard/nmea</string>
<string name="defaultTrackFilePrefix">btnmeatrack</string>
<string name="defaultMockGpsName">bluetooth_gps</string>
@@ -48,14 +48,12 @@
<string name="pref_replace_std_gps_summary_off">Bluetooth GPS will use a new location provider</string>
<string name="pref_mock_gps_name_title">Mock location provider name</string>
<string name="pref_mock_gps_name_summary">Bluetooth GPS name: %s</string>
+ <string name="pref_connection_retries_title">Connection retry number</string>
+ <string name="pref_connection_retries_summary">Number of attempts before exiting: %s</string>
<string name="pref_recording_title">Enable/Disable NMEA log</string>
<string name="pref_recording_summary_off">Track recording is off</string>
<string name="pref_recording_summary_on">Track recording is on</string>
<string name="pref_recording_params_title">Recording parameters</string>
- <string name="pref_mintime_title">Time between records</string>
- <string name="pref_mintime_summary">Time between records in milliseconds</string>
- <string name="pref_mindistance_title">Distance between records</string>
- <string name="pref_mindistance_summary">Distance between records in meters</string>
<string name="pref_trackfile_prefix_title">Trackfiles prefix</string>
<string name="pref_trackfile_prefix_summary">Select the prefix for the track files</string>
<string name="pref_trackfile_directory_title">Trackfiles directory</string>
@@ -74,12 +72,9 @@
<string name="foreground_nmea_recording_started_notification">BlueGps NMEA recording service started</string>
<string name="connection_problem_notification_title">BlueGps: connection problem</string>
<plurals name="connection_problem_notification">
- <item quantity="one">will retry one more time before closing</item>
- <item quantity="other">will retry %d more times before closing</item>
+ <item quantity="one">Will retry one more time before closing</item>
+ <item quantity="other">Will retry %d more times before closing</item>
</plurals>
- <!--
- <string name="connection_problem_notification">Have tried %d times - will retry %d more times</string>
- -->
<string name="service_closed_because_connection_problem_notification_title">BlueGps stopped</string>
<string name="service_closed_because_connection_problem_notification">Reason: too many connection problems</string>
</resources>
diff --git a/res/xml/pref.xml b/res/xml/pref.xml
index 1bede1a..f384034 100644
--- a/res/xml/pref.xml
+++ b/res/xml/pref.xml
@@ -53,6 +53,12 @@
android:title="@string/pref_mock_gps_name_title"
android:defaultValue="@string/defaultMockGpsName"
android:summary="@string/pref_mock_gps_name_summary" />
+ <EditTextPreference
+ android:key="@string/pref_connection_retries_key"
+ android:title="@string/pref_connection_retries_title"
+ android:defaultValue="@string/defaultConnectionRetries"
+ android:inputType="numberDecimal"
+ android:summary="@string/pref_connection_retries_summary" />
</PreferenceScreen>
<CheckBoxPreference
android:enabled="true"
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
index df08bde..2229e6a 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BlueetoothGpsManager.java
@@ -106,10 +106,12 @@ public class BlueetoothGpsManager {
private Notification serviceStoppedNotification;
private Context appContext;
private NotificationManager notificationManager;
+ private int maxConnectionRetries;
- public BlueetoothGpsManager(Service callingService, String deviceAddress) {
+ public BlueetoothGpsManager(Service callingService, String deviceAddress, int maxRetries) {
this.gpsDeviceAddress = deviceAddress;
this.callingService = callingService;
+ this.maxConnectionRetries = maxRetries;
this.appContext = callingService.getApplicationContext();
locationManager = (LocationManager)callingService.getSystemService(Context.LOCATION_SERVICE);
notificationManager = (NotificationManager)callingService.getSystemService(Context.NOTIFICATION_SERVICE);
@@ -126,7 +128,10 @@ public class BlueetoothGpsManager {
serviceStoppedNotification.icon=R.drawable.icon;
Intent restartIntent = new Intent(BluetoothGpsProviderService.ACTION_START_GPS_PROVIDER);
PendingIntent restartPendingIntent = PendingIntent.getService(appContext, 0, restartIntent, PendingIntent.FLAG_CANCEL_CURRENT);
- serviceStoppedNotification.setLatestEventInfo(appContext, appContext.getString(R.string.service_closed_because_connection_problem_notification_title), appContext.getString(R.string.service_closed_because_connection_problem_notification_title), restartPendingIntent);
+ serviceStoppedNotification.setLatestEventInfo(appContext,
+ appContext.getString(R.string.service_closed_because_connection_problem_notification_title),
+ appContext.getString(R.string.service_closed_because_connection_problem_notification),
+ restartPendingIntent);
}
@@ -217,7 +222,7 @@ public class BlueetoothGpsManager {
}
// if bluetooth has bean disabled or
// if two much tries consider that we are enable to connect. So close everything and get out
- if ((!bluetoothAdapter.isEnabled()) || (connectionTry >= 5 )){
+ if ((!bluetoothAdapter.isEnabled()) || (connectionTry >= maxConnectionRetries )){
notificationManager.cancel(R.string.connection_problem_notification_title);
serviceStoppedNotification.when = System.currentTimeMillis();
notificationManager.notify(R.string.service_closed_because_connection_problem_notification_title, serviceStoppedNotification);
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
index 85d63ef..b3349b4 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsActivity.java
@@ -100,6 +100,9 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_MOCK_GPS_NAME);
String mockProvider = sharedPref.getString(BluetoothGpsProviderService.PREF_MOCK_GPS_NAME, getString(R.string.defaultMockGpsName));
pref.setSummary(getString(R.string.pref_mock_gps_name_summary,mockProvider));
+ pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_CONNECTION_RETRIES);
+ String maxConnRetries = sharedPref.getString(BluetoothGpsProviderService.PREF_CONNECTION_RETRIES, getString(R.string.defaultConnectionRetries));
+ pref.setSummary(getString(R.string.pref_connection_retries_summary,maxConnRetries));
pref = (Preference)findPreference(BluetoothGpsProviderService.PREF_GPS_LOCATION_PROVIDER);
if (sharedPref.getBoolean(BluetoothGpsProviderService.PREF_REPLACE_STD_GPS, true)){
String s = getString(R.string.pref_gps_location_provider_summary);
@@ -154,7 +157,7 @@ public class BluetoothGpsActivity extends PreferenceActivity implements OnPrefer
}
} else if (BluetoothGpsProviderService.PREF_BLUETOOTH_DEVICE.equals(key)){
updateDevicePreferenceSummary();
- }
+ }
this.updateDevicePreferenceList();
}
} \ No newline at end of file
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 8e13ef9..ef2410d 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_GPS_LOCATION_PROVIDER = "gpsLocationProviderKey";
public static final String PREF_REPLACE_STD_GPS = "replaceStdtGps";
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";
public static final String PREF_TRACK_FILE_DIR = "trackFileDirectory";
public static final String PREF_TRACK_FILE_PREFIX = "trackFilePrefix";
@@ -87,6 +88,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = sharedPreferences.edit();
String deviceAddress = sharedPreferences.getString(PREF_BLUETOOTH_DEVICE, null);
+ int maxConRetries = Integer.parseInt(sharedPreferences.getString(PREF_CONNECTION_RETRIES, this.getString(R.string.defaultConnectionRetries)));
if (Config.LOGD){
Log.d(BluetoothGpsProviderService.class.getName(), "prefs device addr: "+deviceAddress);
}
@@ -101,7 +103,7 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
if (! sharedPreferences.getBoolean(PREF_REPLACE_STD_GPS, true)){
mockProvider = sharedPreferences.getString(PREF_MOCK_GPS_NAME, getString(R.string.defaultMockGpsName));
}
- gpsManager = new BlueetoothGpsManager(this, deviceAddress);
+ gpsManager = new BlueetoothGpsManager(this, deviceAddress, maxConRetries);
gpsManager.enableMockLocationProvider(mockProvider);
boolean enabled = gpsManager.enable();
if (sharedPreferences.getBoolean(PREF_START_GPS_PROVIDER, false) != enabled){