本文介绍了发送文件,asmack(或任何替代品)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送一个文件, asmack 通过以下内容:

I'm trying to send a file with asmack with the following:

// mConn is an XMPPConnection
FileTransferManager  manager = new FileTransferManager(mConn);
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("[email protected]");
transfer.sendFile(new File(fname), "File for the operator");

我收到也不例外,但在咂嘴日志,我可以看到

I'm receiving no exception but in the smack log I can see

<error type="cancel" code="501"><feature-not-implemented...

有谁知道什么可能是问题的根源在哪里?

Does anyone know what can be the root of the problem?

由于 asmack 一段时间一直没有更新,也许有什么替代呢?

Since asmack hasn't been updated for a while maybe there are any alternatives to it?

推荐答案

我终于想通了。而不是

OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("[email protected]");

现在我使用

String to = mConn.getRoster().getPresence("[email protected]").getFrom();
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(to);

和它的作品的方式。

这篇关于发送文件,asmack(或任何替代品)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:14