1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-19 11:30:44 +02:00

quit Gadgetbridge when bluetooth gets turned off

This commit is contained in:
Andreas Shimokawa 2015-03-17 22:03:54 +01:00
parent a971eca6fd
commit d1ea1b9915

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);
}
}
}