我已經通過藍牙在android的兩個設備之間完成了文件傳輸well.It默認接收到藍牙接收文件夾中。是否可以更改文件的接收位置? 例如。我在兩臺設備上安裝了我自己的應用程序(D1 & D2)。從我在D1上的應用程序,我發送一個文件到D2。是否有可能將這個文件直接接收到D2上我自己的應用程序中打開? 如果是這樣,我該怎麼辦?如何更改android中blutooth傳輸文件的接收位置
我的代碼:
sendDirectly.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (btAdapter.isEnabled()) {
Set<BluetoothDevice> devices = btAdapter.getBondedDevices();
if (devices.size() > 0) {
for (BluetoothDevice device : devices) {
deviceBTAddress=device.getAddress();
}
ContentValues values = new ContentValues();
// values.put(BluetoothShare.URI, Uri.fromFile(new
// File(uri.getPath())).toString());
values.put(BluetoothShare.URI, uri.toString());
values.put(BluetoothShare.MIMETYPE, "image/jpeg");
values.put(BluetoothShare.DESTINATION, deviceBTAddress);
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);
}
}
}
}