0
電話から着用アプリにファイルを送信しようとしましたが、電話で次のようにステータスが正常に送信されています。摩耗側でAndroid Wear Channel APIステータスコード8
NodeApi.GetConnectedNodesResult nodesResult = Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
for (Node node : nodesResult.getNodes()) {
ChannelApi.OpenChannelResult result = Wearable.ChannelApi.openChannel(mGoogleApiClient, node.getId(), "/songs").await();
Channel channel = result.getChannel();
File file = new File(AppUtils.getDownloadsDir(getApplicationContext()),"lift.mp3");
Log.d(TAG, "call: " + file.canRead() + Uri.fromFile(file) + file.length());
channel.sendFile(mGoogleApiClient, Uri.fromFile(file)).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status) {
Log.d(TAG, "onResult: " + status.isSuccess() + " " + status.getStatusMessage());
}
}
);
Log.d(TAG, "Node " + node.getId() + node.getDisplayName() + node.isNearby());
}
しかし、onChannelOpenedは、私は、ファイルを作成し、正しいパスと呼ばなっているが、Channel.receiveFileを呼び出すときに、私は8(INTERNAL_ERROR)のステータスコードを取得resultCallback状況インチ
public void onChannelOpened(final Channel channel) {
if (channel.getPath().equals("/songs")) {
try {
final File outFile = prepareFile("wild.mp3");
if (outFile == null || !outFile.exists()) {
Log.d(TAG, "Failed to create file ");
return;
}
Log.d(TAG, "onChannelOpened: " + mGoogleApiClient.isConnected());
channel.receiveFile(mGoogleApiClient, Uri.fromFile(outFile), false).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status) {
int statusCode = status.getStatusCode();
if (!status.isSuccess()) {
Log.e(TAG, "receiveFile(): Failed to receive file with "
+ "status code = " + statusCode
+ ", and status: " + status.getStatus());
...