它已被问到,但我没有找到任何解决方案.对于蓝牙应用我正在使用bluetoothShare.class.
我的源代码,用于将文件发送到目标设备
MainActvity.class:
Set<BluetoothDevice> devices = btAdapter
.getBondedDevices();
final String btDeviceName = selected_deviceName;
BluetoothDevice device = null;
for (BluetoothDevice itDevice : devices) {
if (btDeviceName.equals(itDevice.getName())) {
device = itDevice;
}
}
if (device != null) {
ContentValues values = new ContentValues();
values.put(BluetoothShare.URI, uri.toString());
values.put(BluetoothShare.MIMETYPE, "image/jpeg");
values.put(BluetoothShare.DESTINATION,
device.getAddress());
values.put(BluetoothShare.DIRECTION,
BluetoothShare.DIRECTION_OUTBOUND);
Long ts = System.currentTimeMillis();
values.put(BluetoothShare.TIMESTAMP, ts);
final Uri contentUri = getApplicationContext()
.getContentResolver().insert(
BluetoothShare.CONTENT_URI, values);
Log.v(TAG, "Insert contentUri: " + contentUri
+ " to device: " + device.getName());
Toast.makeText(getApplicationContext(), "Success", …Run Code Online (Sandbox Code Playgroud) 我需要构建一个Android应用程序,通过蓝牙从远程设备放入/获取文件; 该应用程序还必须浏览远程文件系统.我已经阅读了一些关于OBEX的内容,但是除了市场上的一些很棒的应用程序之外,我还没有找到任何Android版本的例子.如何在应用程序中实现?