以编程方式接受配对请求-Android蓝牙 [英] Accept pairing request programmatically - Android Bluetooth
问题描述
远程设备正在向我的应用程序发送配对请求,并且需要输入用于配对的密码(会出现一个对话框,要求输入密码).我有密码,我想编写一个程序,可以将密码提供给配对请求.
A remote device is sending my application a pairing request and it requires a pin to be entered for pairing (A dialog appears and asks for pin). I have the pin and I want to write a program that could provide the pin to the pairing request.
有人可以告诉我如何在程序中接受配对请求,但不显示要求用户输入密码的对话框.
Can someone please tell me how to accept the pairing request in a program and somehow not show the dialog asking user to enter the pin.
推荐答案
自Android 2.3.3起,有以下方法:
Since Android 2.3.3 there are the methods:
createInsecureRfcommSocketToServiceRecord()
和:
listenUsingInsecureRfcommWithServiceRecord()
在BluetoothAdapter中.
in the BluetoothAdapter.
这篇关于以编程方式接受配对请求-Android蓝牙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!