I'm developing chat app using XMPP
with Openfire 4.1.4, One to one text chat working fine, but while I send image getting error
Here is my code for file send:
Log.e("ad",">selectedImagePath====="+selectedImagePath);
FileTransferManager manager = FileTransferManager.getInstanceFor(Config.conn1);
OutgoingFileTransfer transfer;
transfer = manager.createOutgoingFileTransfer(userJid+"/"+Config.conn1); //JID - user@host/resource
File file = new File(selectedImagePath);
try {
transfer.sendFile(file, "image message test");
} catch (Exception e) {
e.printStackTrace();
}
while (!transfer.isDone()) {
if (transfer.getStatus().equals(AMPExtension.Status.error)) {
Log.e("ad","ERROR!!! " + transfer.getError());
} else if (transfer.getStatus().equals(FileTransfer.Status.cancelled)
|| transfer.getStatus().equals(FileTransfer.Status.refused)) {
Log.e("ad","Cancelled!!! " + transfer.getError());
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (transfer.getStatus().equals(FileTransfer.Status.refused) ) {
Log.e("ad","refused cancelled error" + transfer.getError());
}
else if (transfer.getStatus().equals(FileTransfer.Status.error))
{
Log.e("ad","error="+ transfer.getError());
}
else if (transfer.getStatus().equals(FileTransfer.Status.cancelled))
{
Log.e("ad","cancelled");
}
else {
Log.e("ad","Success");
}
Here is my log:
02-23 14:56:32.489 14951-14951/com.app.chatv1 E/ad: >selectedImagePath=====/storage/emulated/0/Pictures/1519194363122.jpg
02-23 14:56:33.490 14951-14951/com.app.chatv1 E/ad: error=null
I have another related question: when I sent image to server successfully where it will place at server location?