Reputation: 1621
How can I get a bluetooth device's information, available other bluetooth devices and connection notifications?
Upvotes: 3
Views: 1010
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