Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This code transfers file.. </p> <pre><code>FileTransferManager manager = new FileTransferManager(connection); OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("usre2@myHost/Smack"); File file = new File(filenameWithPath); try { transfer.sendFile(file, "test_file"); } catch (XMPPException e) { e.printStackTrace(); } while(!transfer.isDone()) { if(transfer.getStatus().equals(Status.error)) { System.out.println("ERROR!!! " + transfer.getError()); } else if (transfer.getStatus().equals(Status.cancelled) || transfer.getStatus().equals(Status.refused)) { System.out.println("Cancelled!!! " + transfer.getError()); } try { Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); } } if(transfer.getStatus().equals(Status.refused) || transfer.getStatus().equals(Status.error) || transfer.getStatus().equals(Status.cancelled)){ System.out.println("refused cancelled error " + transfer.getError()); } else { System.out.println("Success"); } </code></pre> <p>Also see..<br> <a href="http://harryjoy.com/2012/08/18/file-transfer-in-android-with-asmack-and-openfire/" rel="nofollow noreferrer">http://harryjoy.com/2012/08/18/file-transfer-in-android-with-asmack-and-openfire/</a><br> <a href="https://stackoverflow.com/questions/6339648/filetransfer-in-android-through-xmpp">filetransfer in android through xmpp?</a><br> <a href="https://stackoverflow.com/questions/10397079/android-file-transfer-not-working-via-xmpp-and-openfire">Android File Transfer not working via XMPP and OpenFire</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload