这里我已经让蓝牙可以发现并列出了android中的设备配对,但我无法获得如何在2台设备之间共享文件。请有人帮助我,我被困在这里。
public class MainActivity extends AppCompatActivity {
private static final int REQUEST_ENABLE_BT = 3;
private static final int REQUEST_DISCOVERABLE_BT = 300;
private static final int REQUEST_CONNECT_DEVICE_SECURE = 1;
private BluetoothAdapter bluetoothAdapter;
Switch switchAB;
Toolbar toolbar;
ProgressDialog mProgressDlg;
private ArrayList<BluetoothDevice> mDeviceList = new ArrayList<BluetoothDevice>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
toolbar = (Toolbar) findViewById(R.id.toolbar);
switchAB = (Switch) findViewById(R.id.switchAB);
switchAB.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {here i have make the bluetooth discoverable and listed the pairing of devices in android but i am unable to get how to share the files between 2 devices.
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
ensureDiscoverable();
} else {
disableBluetooth();
}
}
});
ensureDiscoverable();
}
});
registerReceiver(mReceiver, filter);
}
}