1

現在、ウェアラブル (MOTO 360 Android 5.1.1) から携帯電話 (Moto X And​​roid 4.4.4) に Bluetooth 経由でテキストファイルを送信しようとしていますが、「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");
    }
4

1 に答える 1

1

そのためにa を使用しないBluetoothAdapterでください。これを行うには、Play サービスを使用する必要があります。

特定のノード (デバイス) にファイルを送信したくない場合は ChannelAPI を調べ、すべてのデバイス間でバイナリ データを同期したい場合はDataLayerを調べてください

于 2015-06-25T13:43:54.867 に答える