aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
diff options
context:
space:
mode:
authorHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-24 23:41:55 +0200
committerHerbert von Broeuschmeul <Herbert.Broeuschmeul@gmail.com>2010-10-24 23:41:55 +0200
commit5b11f327cf16eeecd279aaed8b384385c0f5fa10 (patch)
tree28a400fd5be3b31b6841f0bb20ee7a1610a620da /src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
parent5d9af268996d502b840608e5f2b3b6ffc68b3c2a (diff)
downloadBlueGPS-5b11f327cf16eeecd279aaed8b384385c0f5fa10.zip
BlueGPS-5b11f327cf16eeecd279aaed8b384385c0f5fa10.tar.gz
BlueGPS-5b11f327cf16eeecd279aaed8b384385c0f5fa10.tar.bz2
add alert messages when bluetooth GPS connection cannot be enabled
Diffstat (limited to 'src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java')
-rw-r--r--src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
index 22b6a0c..1b5c238 100644
--- a/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
+++ b/src/org/broeuschmeul/android/gps/bluetooth/provider/BluetoothGpsProviderService.java
@@ -94,10 +94,6 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
}
if (ACTION_START_GPS_PROVIDER.equals(intent.getAction())){
if (gpsManager == null){
- Notification notification = new Notification(R.drawable.icon, this.getString(R.string.foreground_gps_provider_started_notification), System.currentTimeMillis());
- Intent myIntent = new Intent(this, BluetoothGpsActivity.class);
- PendingIntent myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
- notification.setLatestEventInfo(getApplicationContext(), this.getString(R.string.foreground_service_started_notification_title), this.getString(R.string.foreground_gps_provider_started_notification), myPendingIntent);
if (BluetoothAdapter.checkBluetoothAddress(deviceAddress)){
String mockProvider = LocationManager.GPS_PROVIDER;
if (! sharedPreferences.getBoolean(PREF_REPLACE_STD_GPS, true)){
@@ -111,6 +107,10 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
}
if (enabled) {
gpsManager.enableMockLocationProvider(mockProvider);
+ Notification notification = new Notification(R.drawable.icon, this.getString(R.string.foreground_gps_provider_started_notification), System.currentTimeMillis());
+ Intent myIntent = new Intent(this, BluetoothGpsActivity.class);
+ PendingIntent myPendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT);
+ notification.setLatestEventInfo(getApplicationContext(), this.getString(R.string.foreground_service_started_notification_title), this.getString(R.string.foreground_gps_provider_started_notification), myPendingIntent);
startForeground(R.string.foreground_gps_provider_started_notification, notification);
toast.setText(this.getString(R.string.msg_gps_provider_started));
toast.show();
@@ -180,6 +180,13 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
BlueetoothGpsManager manager = gpsManager;
gpsManager = null;
if (manager != null){
+ if (manager.getDisableReason() != 0){
+ toast.setText(manager.getDisableReason());
+ toast.show();
+ } else {
+ toast.setText(R.string.msg_gps_provider_stopped);
+ toast.show();
+ }
manager.removeNmeaListener(this);
manager.disableMockLocationProvider();
manager.disable();
@@ -195,10 +202,6 @@ public class BluetoothGpsProviderService extends Service implements NmeaListener
edit.putBoolean(PREF_START_GPS_PROVIDER,false);
edit.commit();
}
-// toast.setText(this.getString(R.string.msg_nmea_recording_stopped));
-// toast.show();
- toast.setText(this.getString(R.string.msg_gps_provider_stopped));
- toast.show();
super.onDestroy();
}