Code example for BluetoothSocket

Methods: getInputStreamgetOutputStreamgetRemoteDevice

    public void receiveConnection(BluetoothSocket socket) throws IOException { 
        this.bluetoothSocket = socket; 
        this.bluetoothDevice = socket.getRemoteDevice(); 
        server = new BangBangServer(bluetoothSocket.getInputStream(), bluetoothSocket.getOutputStream(), this); 
    private final BroadcastReceiver mReceiver = new BroadcastReceiver() { 
        public void onReceive(Context context, Intent intent) { 
            String action = intent.getAction(); 
            Log.i(getClass().getSimpleName(), "mReceiver_action:"+ action); 
            // 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); 
Connect your IDE to all the code out there  Get Codota for Java