Hi, I am totally new to XMPP,SMACK and on OPENFIRE. following tutorials i have created this class. It is working fine but do not know is it good approach. i can do chat,register user, and and get users. now i want to send file to another user.but i am getting this error
- Error Error :: null Exception :: org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel*
and my code is.
public void fileTransfer(String destination) throws XMPPException {
// Create the file transfer manager
FileTransferManager manager = FileTransferManager.getInstanceFor(mConnection);
// Create the outgoing file transfer
OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer(destination);
// Send the file
//transfer.sendFile(new File(“abc.txt”), “You won’t believe this!”);
transfer.sendStream(new ByteArrayInputStream(dataToSend), “hello.txt”, dataToSend.length, “A greeting”);
try {
Thread.sleep(10000);
} catch (Exception e) {
}
System.out.println("Status :: " + transfer.getStatus() + " Error :: " + transfer.getError() + " Exception :: " + transfer.getException());
System.out.println("Is it done? " + transfer.isDone());
}
I would like to share my rest code also to confirm i am going in right direction. initially i found some issue in getting all registered users(i am matching them to my local contacts to get registered cotact)
this is my whole code.
SmackConnection.java · GitHub
Please Seniors check my code and guide me in right direction if i am wrong anywhere,
Thanks a lot.