【问题标题】:Data Transfer from Andread Wear Watch to phone via bluetooth通过蓝牙将数据从 Android Wear Watch 传输到手机
【发布时间】:2015-06-25 12:02:35
【问题描述】:

我目前正在尝试通过蓝牙将文本文件从可穿戴设备(MOTO 360 Android 5.1.1)发送到我的手机(Moto X And​​roid 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


    【解决方案1】:

    不要为此使用BluetoothAdapter。您必须使用 Play 服务来执行此操作。

    如果您不想将文件发送到特定节点(设备),请查看ChannelAPI,如果您想在所有设备之间同步二进制数据,请查看DataLayer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-29
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多