Bluetooth connection without pairing

天涯浪子 提交于 2019-12-17 19:25:30

问题


I was looking to find a method to connect two phones using bluetooth without having to first pair them. I am trying to omit the annoying bluetooth pop up request. There is an app on the google store that does this called Bluehood. I wanted to use that style of connection for an app I am building in a totally different niche. You can search for the app on the google store called "Bluehood Social Bluetooth". https://play.google.com/store/apps/details?id=com.mobile.bluehood


回答1:


You may create an insecure bluetooth serial connection between two devices.

To create a connection:

Identify the BluetoothDevice and call its method createInsecureRfcommSocketToServiceRecord

To receive a connection:

Get hold of BluetoothAdapter and call the method listenUsingInsecureRfcommWithServiceRecord

This technique won't require the devices to establish a connection using pairing code. Its available in API level 10 and above.



来源:https://stackoverflow.com/questions/23945171/bluetooth-connection-without-pairing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!