条件修正

This commit is contained in:
ろむねこ 2024-07-12 09:42:24 +09:00
parent 54cf93769d
commit 5e15040c56
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -315,10 +315,15 @@ public class TestService extends Service {
Log.d("BT_Judge", "Not registered device"); Log.d("BT_Judge", "Not registered device");
return; return;
} }
// -----------------------------------------------------
String action = intent.getAction(); // may need to chain this to a recognizing function String action = intent.getAction(); // may need to chain this to a recognizing function
boolean isInCar = getSharedPreferences("Bluetooth_situation", MODE_PRIVATE).getBoolean("isInCarPref", false); boolean isInCar = getSharedPreferences("Bluetooth_situation", MODE_PRIVATE).getBoolean("isInCarPref", false);
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action) && isInCar) { if (!isInCar) {
Log.d("BT_Judge", "Not in car");
return;
}
// -----------------------------------------------------
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
// bluetoothが切断されたときに乗車状態のとき // bluetoothが切断されたときに乗車状態のとき
notificationRunnable = () -> { notificationRunnable = () -> {
// 5分経過した時点でも車に乗っていない場合 // 5分経過した時点でも車に乗っていない場合