When does android show a pairing dialog when using insecure RFCOMM bluetooth sockets?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 13:02:57

问题


I am trying to connect two unpaired android devices via Bluetooth for P2P networking purposes. MitM protection is not required. Android has the createInsecureRfcommSocketToServiceRecord and listenUsingInsecureRfcommWithServiceRecord for this (since API level 10), which works perfectly on modern devices. However, on a Galaxy Ace (Android 2.3.3 = API level 10, connecting with a Galaxy Nexus), it creates a pairing dialog. This happens both on incoming and outgoing connections. (Update: Updating the Galaxy Ace to Android 2.3.6 apparently fixes the problem. Is there a specific Android version that always/never does this?)

After the pairing is accepted, the connection works. For this reason, I think this is not related to Issue 40101: createInsecureRfcommSocketToServiceRecord causes pairing dialog on Android 4.2 which should only happen if the service record does not exist.

I assume this dialog cannot be avoided on devices where it comes up (if it can, explaining how to do this is a valid answer). For this reason, I would like to know when such a dialog is brought up. I did not find anything in the Android Java source (it goes native pretty quickly). I doubt it has anything to do with the Bluetooth version, since the Ace has Bluetooth 2.1 which is supposed to support the required "just works" connections.

If there is anything that would allow me to detect whether a device will support connections without popping the dialog, or if it was clearly fixed to a certain android version, that would immensely help me.

Also, I am looking for a way to easily exclude such devices.


回答1:


Currently I have the same problem as you. I've developed an application to exchange messages between BT terminals and I'm testing it on different phones ( I have S3, S2, S plus, Nexus One and Galaxy Y) to analize the behaviour. Phones have this specs:

  • Samsung S2 : Custom ROM (Android v4.2.1) - Rooted
  • Samsung S3 : Stock ROM (Android v4.1.2)
  • Samsung S+ : Custom ROM (Android v4.1.2) - Rooted
  • Samsung GY : Custom ROM (Android v2.3.6) - Rooted
  • Nexus One : Stock ROM (Android v2.3.6) - Rooted

As far i can tell you from my experience, S2 and S3 after some time start to show the pairing dialog even if they are already paired and exchanging data. This happens all the time I include one of this two phones in my testbed, others are working fine and never ask for pairing ( expecially Nexus One that has a flawless behaviour).

I have made long running tests (from 4 to 6 hours) and I still can't figure out why this phones ask for pairing sometimes after 3 hours.. sometimes after 10 minutes.

The only thing that i would like to point you out is that even if u are using insecure connection you could still be asked for human interaction for pairing. Give a look at that (taken from http://en.wikipedia.org/wiki/Bluetooth) :

Just works: As implied by the name, this method just works. No user interaction is required; however, a device may prompt the user to confirm the pairing process. This method is typically used by headsets with very limited IO capabilities, and is more secure than the fixed PIN mechanism which is typically used for legacy pairing by this set of limited devices. This method provides no man in the middle (MITM) protection.



来源:https://stackoverflow.com/questions/14804304/when-does-android-show-a-pairing-dialog-when-using-insecure-rfcomm-bluetooth-soc

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