0
我正在編寫一個代碼,用於偵聽藍牙設備斷開連接,然後執行某些操作。我會如何去做這件事?我不完全確定我想在它之後放置什麼,我想先把它整理出來。希望我對這個代碼沒有完全錯誤,因爲我是新開發人員。這是我到目前爲止有:收聽藍牙狀態
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (BluetoothAdapter.ACTION_ACL_DISCONNECTED.equals(action))
{ // This will be the followup action, once I figure out what I want it to be.