[英]What is the fastest way to transfer data from watch to phone Android wear
[英]Data Transfer from Andread Wear Watch to phone via bluetooth
我目前正在尝试通过蓝牙将文本文件从可穿戴设备(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");
}
请勿为此使用BluetoothAdapter
。 您必须使用Play服务来做到这一点。
看看在ChannelAPI如果你wan't将文件发送到特定的节点(设备)或者在数据层 ,如果你想同步所有设备之间的二进制数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.