Monday, February 17, 2014

Automatic Bluetooth pairing problems android


Automatic Bluetooth pairing when android is encountered SSP pairing, that just pop up "Bluetooth pairing application" box, simply click on the "pairing" and "mismatch", this time as a function of my radio listeners
 public class MessageReceiver extends BroadcastReceiver {
public void onReceive (Context context, Intent intent) {
if (action.equals (BluetoothDevice.ACTION_PAIRING_REQUEST)) {
BluetoothDevice device = intent.getParcelableExtra (BluetoothDevice.EXTRA_DEVICE);
try {
BtConnectOperation.BtSetPairingConfirmation (device.getClass (), device);
} Catch (Exception e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
mConnService.pairEnd ();
}
}
}

This BtSetPairingConfirmation function which follows, using reflection
 / / setting determines 
static public boolean BtSetPairingConfirmation (Class btClass, BluetoothDevice device)
throws Exception {
Method SetPairingConfirmationMethod = btClass.getMethod ("setPairingConfirmation",
boolean.class);
Boolean returnValue = false;
returnValue = (Boolean) SetPairingConfirmationMethod.invoke (device, true);

return returnValue;
}

Why can not directly or automatically match it, or will pop up "Bluetooth pairing application" box, the great God who gave some advice, thank you ah<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Which God to answer the next big ah,
Reply:
No one to answer my questions? ? ? ?
Reply:
http://www.oschina.net/question/106603_54246
Reply:
reference to the third floor lieri111 reply:
http://www.oschina.net/question/106603_54246

I have seen this, ah, this is when you can use the pin code pairing so used, but I am now ssp pairing ah, just pop up a dialog box is paired ah, not the same

No comments:

Post a Comment