连接蓝牙设备

时间:2013-09-25 13:39:58

标签: android

如何通过点击设备在发现后连接蓝牙设备? 有任何想法吗 ?请帮帮我

public void onReceive(Context context, Intent intent) {
            String action =intent.getAction();
            if(BluetoothDevice.ACTION_FOUND.equals(action)){
                BluetoothDevice device =intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                marrayAdapter.add("Discovered:");
                marrayAdapter.add(device.getName()+"\n"+device.getAddress());
            }
        }
    };
    IntentFilter filter =new IntentFilter(BluetoothDevice.ACTION_FOUND);
    registerReceiver(mreceiver, filter);
    mBlue.startDiscovery();

    }

0 个答案:

没有答案