Hallo everybody,
I am new to GWT. To start working on it, I have just programmed a chat
application for Android (SDK m5-rc15).
At present I am exploiting only the GWT (1.5.1) API, with the 'smack'
library which allows connection to a xmpp server. (For now I'm using
just Firefox as XMPP server and a Spark client).
I have a big problem: my application works perfectly with many
browsers (Chrome, IE, Mozilla, Opera), but it does not work so well on
Android.
In fact, on Android I cannot send and receive real-time messages:
sometimes I lose message, sometimes the message I send from one side
(for example from the Spark client) appears on the other side, that is
on my application running on Android, only after sending a further
message from my application itself. So in case I send 'hallo Android'
from the Spark client, this text is appended on the texbox of my
applciation only AFTER I send another message (e.g. 'hallo Spark')
from my application' (so on my application you can read the appended
text 'hallo Spark hallo Android' instead of 'hallo Android hallo
Spark)
In my application the application server opens a connection to a XMPP
server, before opening a chat to any Spark client.
On my server-side I have 4 chat methods,which I invoke from the client
by means of RPC calls.
My question is : why does my application not work only with Android??
Do I have to change any configuration parameter on Android for that?
Here I attach the four abovementioned chat methods:
public boolean connect() {
try {
connection.connect();
connection.login(username,psw);
} catch (XMPPException e) {
e.printStackTrace();
return false;
}
return true;
}
public boolean chat(String participant){
participantName = participant.substring(0,
participant.lastIndexOf('@'));
this.chat1 =
connection.getChatManager().createChat(participant, new
MessageListener() {
public void processMessage(Chat chat1, Message
message) {
msg = participantName + ": " +
message.getBody();
System.out.println("Received message
--> " + msg);
synchronized(messageList){
messageList.add(msg);
messageList.notify();
}
}
});
return true;
}
public String send(String textIn) {
try {
chat1.sendMessage(textIn);
} catch (XMPPException e) {
e.printStackTrace();
}
textOutMod = username + ": " + textIn;
return textOutMod;
}
public String receive() {
synchronized (messageList){
while (messageList.size() == 0){
try{
messageList.wait();
} catch (InterruptedException ignore){
}
}
textInMod = "";
for (int j = 0; j < messageList.size(); j++) {
if (textInMod.length() > 0) textInMod = textInMod + "\n" +
messageList.elementAt(j);
else textInMod = (String)messageList.elementAt(j);
}
messageList.clear();
}
return textInMod;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---