quit Gadgetbridge when bluetooth gets turned off

master
Andreas Shimokawa 2015-03-17 22:03:54 +01:00
parent a971eca6fd
commit d1ea1b9915
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,12 @@ public class BluetoothStateChangeReceiver extends BroadcastReceiver {
Intent connectIntent = new Intent(context, BluetoothCommunicationService.class);
connectIntent.setAction(BluetoothCommunicationService.ACTION_CONNECT);
context.startService(connectIntent);
} else if (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1) == BluetoothAdapter.STATE_OFF) {
Intent stopIntent = new Intent(context, BluetoothCommunicationService.class);
context.stopService(stopIntent);
Intent quitIntent = new Intent(ControlCenter.ACTION_QUIT);
context.sendBroadcast(quitIntent);
}
}
}