How to handle offline file transfer smack android

Hello folks,

I was able now to use file transfer and it works without problems. But now, what happens if the receiver is offline? I can´t find any hint here or in SO. In that way, I can receive files with the FileTransferListener. But if I am sending a file to offline receiver, after going online, the receiver gets no file (like for example it is possible with simple message).

mFileTransferManager = FileTransferManager.getInstanceFor(mConnection);

mFileTransferManager.addFileTransferListener(new FileTransferListener() {

public void fileTransferRequest(FileTransferRequest request) {

IncomingFileTransfer incomingFileTransfer = request.accept();

String fileName = incomingFileTransfer.getFileName();

String senderJid = incomingFileTransfer.getPeer();

try {

InputStream inputStream = incomingFileTransfer.recieveFile();

ByteArrayOutputStream bao = new ByteArrayOutputStream();

int read;

byte[] buf = new byte[1024];

while ((read =, 0, buf.length)) != -1) {

bao.write(buf, 0, read);



byte[] dataReceived = bao.toByteArray();

saveFile(senderJid, fileName, dataReceived);

} catch (SmackException e) {


} catch (XMPPException.XMPPErrorException e) {


} catch (IOException e) {





Has anybody some experience about that? I haven´t found the right doc in the smack API.