quit BluetoothServer when Bluetooth is disabled
This commit is contained in:
parent
73ad5bd6b3
commit
57e4315e18
@ -66,7 +66,7 @@ public class BluetoothServer extends Thread {
|
||||
public void run() {
|
||||
|
||||
isRunning = true;
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
|
||||
try {
|
||||
serverSocket = adapter.listenUsingInsecureRfcommWithServiceRecord("FDroid App Swap", BluetoothConstants.fdroidUuid());
|
||||
@ -83,6 +83,11 @@ public class BluetoothServer extends Thread {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!adapter.isEnabled()) {
|
||||
Utils.debugLog(TAG, "User disabled Bluetooth from outside, stopping.");
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
BluetoothSocket clientSocket = serverSocket.accept();
|
||||
if (clientSocket != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user