Ajay Singh
Ajay Singh

Reputation: 1621

Bluetooth connection notification

How can I get a bluetooth device's information, available other bluetooth devices and connection notifications?

Upvotes: 3

Views: 1010

Answers (1)

Grook
Grook

Reputation: 405

To get bluetooth devices you have to obtain instance of BluetoothAdapter and invoke the startDiscovery() method. Also you need to register ACTION_FOUND intent. It may be done this way:

private BroadcastReceiver mBlueToothInfoDiscoveryListener = new BroadcastReceiver() {

@Override
public void onReceive(Context context, Intent intent) 
{
    String action = intent.getAction();
    if (BluetoothDevice.ACTION_FOUND.equals(action)) 
    {
         BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    }
 }

To get information about found device you can use getAddress() method .

Upvotes: 5

Related Questions