Обнаружено действие приемника вещания - PullRequest
0 голосов
/ 23 января 2019

Я разрабатываю приемник вещания Android для соединения Bluetooth-le

Проблема в том, что приемник вещания принимает все, кроме ACTION_FOUND.

Это фильтр намерений

IntentFilter filter1 = new IntentFilter();

filter1.addAction(BluetoothDevice.ACTION_FOUND);
filter1.addAction(BluetoothDevice.ACTION_CLASS_CHANGED);
filter1.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
filter1.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);

registerReceiver(mBroadcastReceiver1, filter1);

Это вещательный приемник

private final BroadcastReceiver mBroadcastReceiver1 = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {

    final String action = intent.getAction();
    Log.e(TAG, "onReceive: ACTION____________come in Receiver1");
    if(BluetoothAdapter.ACTION_DISCOVERY_STARTED.equals(intent.getAction())) {
        Log.e("Action?::", action);
    }
    else if(BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(intent.getAction())) {
        Log.e("Action?::", action);
    }
    else if (BluetoothDevice.ACTION_CLASS_CHANGED.equals(intent.getAction())) {
        Log.e("Action?::", action);
    }
    else if (BluetoothDevice.ACTION_FOUND.equals(intent.getAction())) {
        Log.e("Action?::", action);
    }

  }
};

Это Журнал

E/Now Action?::: android.bluetooth.adapter.action.DISCOVERY_STARTED
E/Now Action?::: android.bluetooth.device.action.CLASS_CHANGED
E/Now Action?::: android.bluetooth.adapter.action.DISCOVERY_FINISHED

2019-01-23 18:13:58.414 4796-4834/? W/BroadcastQueue: Permission Denial: receiving Intent { act=android.bluetooth.device.action.FOUND flg=0x10 (has extras) } to ProcessRecord{29e5269 29402:com.reziena.user.reziena_b/u0a209} (pid=29402, uid=10209) requires android.permission.ACCESS_COARSE_LOCATION due to sender com.android.bluetooth (uid 1002)
2019-01-23 18:13:58.414 5266-5534/? V/BluetoothEventManager: onReceive :: android.bluetooth.device.action.FOUND
2019-01-23 18:13:58.414 5227-5358/? D/BluetoothUtils: getBtEnabledContainers(): btContainers = []
2019-01-23 18:13:58.414 5266-5534/? V/BluetoothEventManager: onReceive :: android.bluetooth.device.action.FOUND
...