現在、ウェアラブル (MOTO 360 Android 5.1.1) から携帯電話 (Moto X Android 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");
}