Small changes
This commit is contained in:
@ -94,20 +94,21 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
// Miscellaneous.logEvent("i", "BluetoothReceiver", "Bluetooth event.", 4);
|
||||
|
||||
String action = intent.getAction();
|
||||
|
||||
Miscellaneous.logEvent("i", "BluetoothReceiver", "Bluetooth event: " + action, 5);
|
||||
|
||||
BluetoothDevice bluetoothDevice = null;
|
||||
|
||||
if(action.equals(BluetoothDevice.ACTION_ACL_CONNECTED) | action.equals("android.bluetooth.device.action.ACL_CONNECTED"))
|
||||
{
|
||||
if(action.equals(BluetoothDevice.ACTION_ACL_CONNECTED) || action.equals("android.bluetooth.device.action.ACL_CONNECTED"))
|
||||
{
|
||||
bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
lastAffectedDevice = bluetoothDevice;
|
||||
lastAction = action;
|
||||
connectedDevices.add(bluetoothDevice);
|
||||
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothConnectionTo), bluetoothDevice.getName()), 3);
|
||||
}
|
||||
else if(action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) | action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) | action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECTED") | action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECT_REQUESTED"))
|
||||
else if(action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) || action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) || action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECTED") || action.equals("android.bluetooth.device.ACTION_ACL_DISCONNECT_REQUESTED"))
|
||||
{
|
||||
bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
lastAffectedDevice = bluetoothDevice;
|
||||
@ -115,7 +116,7 @@ public class BluetoothReceiver extends BroadcastReceiver implements AutomationLi
|
||||
connectedDevices.remove(bluetoothDevice);
|
||||
Miscellaneous.logEvent("i", "BluetoothReceiver", String.format(context.getResources().getString(R.string.bluetoothDisconnectFrom), bluetoothDevice.getName()), 3);
|
||||
}
|
||||
else if(action.equals(BluetoothDevice.ACTION_FOUND) | action.equals("android.bluetooth.device.ACTION_FOUND"))
|
||||
else if(action.equals(BluetoothDevice.ACTION_FOUND) || action.equals("android.bluetooth.device.ACTION_FOUND"))
|
||||
{
|
||||
bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
lastAffectedDevice = bluetoothDevice;
|
||||
|
@ -422,7 +422,7 @@
|
||||
<string name="noDataChangedReadingAnyway">It appears no data change has been saved. However there may have been changes in memory that need to be rolled back. Rereading file.</string>
|
||||
<string name="bluetoothConnection">Bluetooth connection</string>
|
||||
<string name="bluetoothConnectionTo">Bluetooth connection to %1$s</string>
|
||||
<string name="bluetoothDisconnectFrom">Bluetooth connection to %1$s torn</string>
|
||||
<string name="bluetoothDisconnectFrom">Bluetooth connection from %1$s torn</string>
|
||||
<string name="bluetoothDeviceInRange">Bluetooth device %1$s in range.</string>
|
||||
<string name="bluetoothDeviceOutOfRange">Bluetooth device %1$s out of range.</string>
|
||||
<string name="anyDevice">any device</string>
|
||||
|
Reference in New Issue
Block a user