mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
quit Gadgetbridge when bluetooth gets turned off
This commit is contained in:
parent
a971eca6fd
commit
d1ea1b9915
@ -25,6 +25,12 @@ public class BluetoothStateChangeReceiver extends BroadcastReceiver {
|
|||||||
Intent connectIntent = new Intent(context, BluetoothCommunicationService.class);
|
Intent connectIntent = new Intent(context, BluetoothCommunicationService.class);
|
||||||
connectIntent.setAction(BluetoothCommunicationService.ACTION_CONNECT);
|
connectIntent.setAction(BluetoothCommunicationService.ACTION_CONNECT);
|
||||||
context.startService(connectIntent);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user