我的Android应用程序处于蓝牙SPP服务器模式并侦听客户端设备,我的应用程序知道配对该设备所需的密码。通过应用程序处理蓝牙spp配对请求
我的问题是, 是否有可能通过应用程序处理配对请求。 感谢和问候。
我的Android应用程序处于蓝牙SPP服务器模式并侦听客户端设备,我的应用程序知道配对该设备所需的密码。通过应用程序处理蓝牙spp配对请求
我的问题是, 是否有可能通过应用程序处理配对请求。 感谢和问候。
不是 - 因为从安全的角度来看,重要的是让用户了解配对。这个想法是,设备配对和绑定一次,然后向前连接发生应用程序自动启动,无需重新配对(或用户干预)
是的,可以通过应用程序进行配对。我在我的应用程序中配对。 为此,你必须做出IBluetooth接口对象可通过这种方式:
IBluetooth mBluetoothService;
Field fie = Class.forName(bluetoothAdapter.getClass().getName()).getDeclaredField("mService");
fie.setAccessible(true);
mBluetoothService = (IBluetooth) fie.get(bluetoothAdapter);
通过使用这个对象,你可以使用IBluetooth接口功能与设备配对。 (对于自动配对正常序列)::
mBluetoothService.setPin(deviceAddress, PIN);
mBluetoothService.setTrust(deviceAddress);
mBluetoothService.createBond(deviceAddress);
mBluetoothService.setPairingConfirmation(deviceAddress, false);
mBluetoothService.cancelPairingUserInput(deviceAddress);
通过使用这些功能可以用任何BT设备配对编程。
但是,Android可以随时强制这些方法显示一些确认弹出权? – ericn 2013-08-27 12:15:06