Home > other >  Android bluetooth pairing and connection
Android bluetooth pairing and connection

Time:11-01

Android how to match?
Began to search after open bluetooth, can search to the new equipment and then use the
 
Private final BroadcastReceiver mReceiver=new BroadcastReceiver () {
Public void onReceive (Context Context, Intent Intent) {
The String action=intent. GetAction ();
//the When discovery finds a device
If (BluetoothDevice. ACTION_FOUND. Equals (action)) {
//Get the BluetoothDevice object from the Intent
BluetoothDevice device=intent. GetParcelableExtra (BluetoothDevice. EXTRA_DEVICE);
MArrayAdapter. Add (device. The getName () + "/n" + device. The getAddress ());
Devices. The add (device);
}
}
};

To receive the new equipment
The problem is how to match?
The client's situation:
I see online can use the following code to enter the select the bluetooth device interface, there is a search out all the equipment (View)
 
Intent blueList=new Intent (" android. Bluetooth. Devicepicker. Action. LAUNCH ");
StartActivity (blueList);

When I click on one of the equipment (View) interface to return to my own Activity, how can I get his ordered which device is it
So I can match or a connection
How do paired, online said is a automatic matching search immediately to the device, I think is to choose one of the equipment matching


  • Related