mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
quit Gadgetbridge when bluetooth gets turned off
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user