How to Increase Bluetooth pairing window timeout in Android
我正在尝试增加蓝牙配对窗口的超时(当前该窗口仅停留几秒钟)。有什么办法可以实现此操作?
我已经尝试过这些stackoverflow链接中的方法:
如何以编程方式与Android配对蓝牙设备
如何在Android上以编程方式配对蓝牙设备
Android蓝牙,覆盖配对提示
以上所有链接都没有我要找的答案,有人可以帮助我解决这个问题吗?是否有任何方法可以增加蓝牙配对屏幕的超时时间
至此,"配对"窗口将永不超时
1 2 3 4 5 6 7 8 9 10 11 12 | public void pairDevice(final BluetoothDevice device) { String ACTION_PAIRING_REQUEST ="android.bluetooth.device.action.PAIRING_REQUEST"; Intent intent = new Intent(ACTION_PAIRING_REQUEST); String EXTRA_DEVICE ="android.bluetooth.device.extra.DEVICE"; intent.putExtra(EXTRA_DEVICE, device); String EXTRA_PAIRING_VARIANT ="android.bluetooth.device.extra.PAIRING_VARIANT"; int PAIRING_VARIANT_PIN = 0; intent.putExtra(EXTRA_PAIRING_VARIANT, PAIRING_VARIANT_PIN); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } |