कॉल विधि bluetoothScanning, संदर्भ की आवश्यकता है
void bluetoothScanning(){
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
context.registerReceiver(mReceiver, filter);
final BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothAdapter.startDiscovery();
}
// Create a BroadcastReceiver for ACTION_FOUND.
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
// Discovery has found a device. Get the BluetoothDevice
// object and its info from the Intent.
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
String deviceName = device.getName();
String deviceHardwareAddress = device.getAddress(); // MAC address
Log.i("Device Name: " , "device " + deviceName);
Log.i("deviceHardwareAddress " , "hard" + deviceHardwareAddress);
}
}
};
परिणाम
नाम: LE-बोस रिवोल्व + SoundLink deviceHardwareAddress : मैक 04: 52: सी 7: डी 1: बी 2: 76
.....
किसी को इस आरएसएसआई चीज़ पर अनुभव है? मैं यहाँ थोड़ा असुरक्षित हूँ, क्योंकि यह निरंतर के रूप में definded है? – xenonite
आपका पहला लिंक - http://developer.android.com/guide/topics/wireless/bluetooth.html#FindingDevices मर चुका है – Dayan
लिंक वर्तमान में – Charlie