简体   繁体   English

拒绝权限:不允许发送广播android.bluetooth.device.action.FOUND

[英]Permission Denial: not allowed to send broadcast android.bluetooth.device.action.FOUND

I am trying to sendbroadcast. 我正在尝试广播。 After execution, I get following error: 执行后,出现以下错误:

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.bluetooth.device.action.FOUND from pid=24885, uid=10370 java.lang.SecurityException:权限拒绝:不允许从pid = 24885,uid = 10370发送广播android.bluetooth.device.action.FOUND

If anyone has experience with this error, your kind help will be appreciated. 如果有人遇到此错误,将为您提供帮助。 Here is my method: 这是我的方法:

    private void DiscoverOBDConnection() {
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.startDiscovery();

// Create a BroadcastReceiver for ACTION_FOUND
final List<String> discoverableDevicesList = new ArrayList<String>();
final BroadcastReceiver mReceiver = new BroadcastReceiver() {
  public void onReceive(Context context, Intent intent) {
    intent=new Intent(BluetoothDevice.ACTION_FOUND);
    String action = intent.getAction();
    // When discovery finds a device
    sendBroadcast(intent);
    if (BluetoothDevice.ACTION_FOUND.equals(action)) {
      // Get the BluetoothDevice object from the Intent
      BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
      discoverableDevicesList.add(device.getName() + "\n" + device.getAddress() + "\n");
      String discoveredDeviceName = device.getName();
      }
    }
  }
};
mReceiver.onReceive(this, new Intent(BluetoothDevice.ACTION_FOUND));

} }

manifest permissions: 清单权限:

  <uses-permission android:name="android.permission.BLUETOOTH"/>

add admin permission to access bluetooth 添加管理员权限以访问蓝牙

    <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 接收广播Intent时出错{act = android.bluetooth.device.action.FOUND flg = 0x10} - Error receiving broadcast Intent { act=android.bluetooth.device.action.FOUND flg=0x10} 权限拒绝:不允许在android中发送广播 - Permission Denial: not allowed to send broadcast in android 权限拒绝:不允许发送广播android - Permission Denial: not allowed to send broadcast android Permission Denial:不允许发送广播 android.intent.action.AIRPLANE_MODE - Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE SecurityException:权限被拒绝:不允许发送广播android.intent.action.BATTERY_CHANGED - SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BATTERY_CHANGED java.lang.SecurityException:权限拒绝:不允许发送广播android.hardware.usb.action.USB_STATE - java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.hardware.usb.action.USB_STATE 权限拒绝:不允许发送广播android.intent.action.HEADSET_PLUG - Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG CSipSimple-java.lang.SecurityException:权限拒绝:不允许发送广播android.intent.action.Phone_State - CSipSimple - java.lang.SecurityException : Permission Denial: not allowed to send broadcast android.intent.action.Phone_State 应用程序因 Permission Denial 崩溃:不允许发送广播 android.intent.action.SCREEN_ON - App crashes with Permission Denial: not allowed to send broadcast android.intent.action.SCREEN_ON java.lang.SecurityException:权限拒绝:不允许在android 7(N OS)上发送广播android.intent.action.NEW_OUTGOING_CALL - java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.NEW_OUTGOING_CALL on android 7 (N OS)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM