Search code examples
androidxmppsmack

Xmpp and Android


I am using Xmpp protocol to create chat application with the help of smack api.n which user can able to chat with the other.however user unable to receive offline message .but if the user has more than one offline message ,the messages are received.

what the solution?

ConnectionConfiguration config = new ConnectionConfiguration(Constants.CHAT_SERVER,Constants.CHAT_SERVER_PORT,Constants.CHAT_SERVER_DOMAIN);
        config.setSASLAuthenticationEnabled(false);
        connection = new XMPPConnection(config);
        try
        {
            connection.connect(); 
            Log.i("XMPPClient", "[SettingsDialog] Connected to " + connection.getHost());
        } 
        catch (XMPPException ex) 
        {
            Log.i("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost());            
        }

            connection.login(userName, password); 

Solution

  • Make sure to send presence after you log in, in order to receive your offline messages. Also, there are many servers that don't implement offline messaging; make sure that's not the problem by checking with another client.