如何从蓝牙配对中删除弹出窗口?

How to remove popup from Pairing in Bluetooth?

我正在 2 台设备上编写应用程序,将这 2 台设备配对并发送一般消息。

每当我开始与另一台设备配对时(即使在我自己的应用程序中,在另一台设备上)我都会收到提示 "do you want to pair device xxx"

(类似于此弹出窗口>)

并且用户实际上必须按下配对。这样 2 个设备就会配对。

假设我在两部手机上都有自己的应用程序, 有没有办法让我自动配对它们,而其他用户实际上不必按 "Pair"?

无需用户交互的配对需要 BLUETOOTH_PRIVILEGED 权限,第三方开发者/应用程序无法使用此权限。

引用documentation

Allows applications to pair bluetooth devices without user interaction, and to allow or disallow phonebook access or message access. This is not available to third party applications.

Constant Value: "android.permission.BLUETOOTH_PRIVILEGED"