How to transfer file using Smack4.1 in Chat applications?

Here is my code snippet what I have for the file transfer:

`mFTM= FileTransferManager.getInstanceFor(mConnection);
transfer = mFTM.createOutgoingFileTransfer(user_name.toLowerCase()+"@52.4.53.212"+"/Smack");
try {
transfer.sendFile(new File(profileImagePath),“file”);
} catch (SmackException e) {
e.printStackTrace();
}

Code to receive files:
mFTM.addFileTransferListener(new FileTransferListener() {
@Override
public void fileTransferRequest(FileTransferRequest request) {
if (request!=null){
IncomingFileTransfer intransfer=request.accept();
try {
intransfer.recieveFile();
Log.e(“inFile”, intransfer.recieveFile()+"");
} catch (SmackException e) {
e.printStackTrace();
} catch (XMPPException.XMPPErrorException e) {
e.printStackTrace();
}
}
}
});`

where mFTM is the instance of FileTransferManager.

Any help in this is appriciated.Thank You

A googe seach on smack file transfer gives:

Smack XMPP File Transfer · igniterealtime/Smack Wiki · GitHub

which refers to

ProjectMAXS/maxs · GitHub

for an working example.