i developing group chat app using android-xmpp, in that i don't know how to send and recive pics-image or location (using map).
So any one one can please give me way to do these.
currently , i got text message and add to list view , like following ,
Message msg = new Message(to, Message.Type.groupchat);
msg.setBody(text);
if (Constants.connection != null) {
try {
Constants.connection.sendPacket(msg);
Log.d("Send to room : Name : ", to);
Log.d("store", "store data to db");
//DBAdapter.addUserData(new UserData(text, "", "1" ,beam_id));
} catch (Exception e) {
Log.d("ooo", "msg exception" + e.getMessage());
}
messages.add(text);
runOnUiThread(new Runnable() {
public void run() {
// set to listview
setMyChatAdapter();
}
});
}
and receive using StanzaTypeFilter. So how for image and location sharing ?
I try following code for image using FileTransferManager , using smack-extensions-4.1.3-sources.jar .
private void sendImage()
{
FileTransferManager mg=new FileTransferManager(Constants.connection);
OutgoingFileTransfer transfer = mg.createOutgoingFileTransfer(beam_id+"@"+Constants.conference_name + "/" + Constants.resources);
File file = new File(selectedImagePath);
try {
transfer.sendFile(file, "test_file");
} catch (Exception e) {
e.printStackTrace();
}
while(!transfer.isDone()) {
if(transfer.getStatus().equals(FileTransfer.Status.error)) {
System.out.println("ERROR!!! " + transfer.getError());
} else if (transfer.getStatus().equals(FileTransfer.Status.cancelled)
|| transfer.getStatus().equals(FileTransfer.Status.refused)) {
System.out.println("Cancelled!!! "+ transfer.getError());
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(transfer.getStatus().equals(FileTransfer.Status.refused) || transfer.getStatus().equals(FileTransfer.Status.error)
|| transfer.getStatus().equals(FileTransfer.Status.cancelled)){
System.out.println("refused cancelled error"+ transfer.getError());
} else {
System.out.println("Success");
}
}
But when i access that file using following ,
FileTransferManager mg=new FileTransferManager(Constants.connection);
it give me error ... has a private access of ... So , i find constructor of that file is private , this is jar file so i can not change it to public .
So, how can i access that file-class into my class ?
So, how can i share(send-receive) image and location message in chat ?
Please help me as soon as possible.
Thanks in advance.