Don't receive the message on Android's smack

I use smack on Android, Below is the version I used:

        implementation 'org.igniterealtime.smack:smack-android-extensions:4.3.4'
        implementation 'org.igniterealtime.smack:smack-tcp:4.3.4'

Strange, when I don’t send the message, I will not receive the message, is this why?
Here is my code, is very simple:

        val config = XMPPTCPConnectionConfiguration.builder()
            .setUsernameAndPassword("lily", "123456")
            .setXmppDomain("192.168.1.40")
            .setHostAddress(InetAddress.getByName("192.168.1.40"))
            .setPort(5222)
            .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
            .enableDefaultDebugger()
            .build()

        val conn = XMPPTCPConnection(config)
        conn.connect()
        conn.login()

        val chatManager = ChatManager.getInstanceFor(conn)
        chatManager.addIncomingListener { _, message, chat -> chat.send(message.body) }

        // send message
        // val jid = JidCreate.entityBareFrom("dzl@dazhou.cn")
        // val chat = chatManager.chatWith(jid)
        // chat.send("Hello world!")

I use the Spark to my Android sends the message, but did not receive any messages,If at the end of the code above I add a send messages code , I can received the message, if I don’t send messages I can’t receive the messages?
I don’t know where my code error, who can tell me, thank you!

One reason I could think of is that maybe Spark is not sending a message of type ‘chat’, but I’m not sure.

Did you take a look at the stanzas being sent to spot any differences?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.