【发布时间】:2015-06-25 12:02:35
【问题描述】:
我目前正在尝试通过蓝牙将文本文件从可穿戴设备(MOTO 360 Android 5.1.1)发送到我的手机(Moto X Android 4.4.4),但是当我执行“onSendToPhone”方法时,我得到以下信息手表上的错误信息:
No application can handle this action
也许有人可以帮助我并找到解决方案;)
这是我用来从手表传输数据的代码:
public void onSendToPhone(View view)
{
//...
// inside method
// Check if bluetooth is supported
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
if (btAdapter == null) {
// Device does not support Bluetooth
// Inform user that we're done.
Log.d("TAG","Bluetooth not found");
return;
}
File sendFile= new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "<filename>");
// bring up Android chooser
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(sendFile));
startActivity(intent);
Log.d("TAG", "File is sent via Bluetooth");
}
【问题讨论】:
标签: android wear-os android-bluetooth moto-360