【发布时间】:2014-09-28 01:50:39
【问题描述】:
我尝试打开与特定 MAC 地址的配对对话框。
BluetoothDevice device;
String bt_mac = read.toUpperCase(Locale.GERMAN);
device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(bt_mac);
Intent intent = new Intent("android.bluetooth.device.action.PAIRING_REQUEST");
intent.putExtra("android.bluetooth.device.extra.DEVICE", device);
intent.putExtra("android.bluetooth.device.extra.PAIRING_VARIANT", 0);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
但我收到的只是这条错误消息:
java.lang.SecurityException: Permission Denial: 开始 Intent { 行动=android.bluetooth.device.action.PAIRING_REQUEST flg=0x10000000 cmp=com.android.settings/.bluetooth.BluetoothPairingDialog(有 额外内容)}来自 ProcessRecord{434110a0 15553:de.test.testapp/u0a10003} (pid=15553, uid=10003) 未从 uid 1000 导出
我认为问题在于消息的这一部分:notexported from uid 1000 但我不知道如何解决它
【问题讨论】:
-
你有
android.permission.BLUETOOTH_ADMIN的权限吗? -
是的,我有。