Received subscribe user get only first time in android

I am sending subscribe request to B user from A user account using below code:

 try {
            var jid = JidCreate.bareFrom(jidName)
            if(!roster!!.contains(jid)){
                var pref = Presence(Presence.Type.subscribe)
                pref.to = jid
                mConnection?.sendStanza(pref)
                roster?.createEntry(jid, nickName, null)
            }
            getUserList()
        }catch (e: Exception){
            Log.e("UserList", e.toString())
        }

After sending a request, I can see the pending requests in the getUserList() method.

Now I am logged in into that B user to get received subscribe user. Which I am getting in below code:

override fun processStanza(packet: Stanza?) {
        packet?.let {
            var presence = it as Presence
            if(presence.type == Presence.Type.subscribe){
                Log.e("SmackConnection","Subcribe request")
            }
        }
    }

After log out and logged in again that time processStanza not called. So I checked again in A user from where I send a request to B User. Now I can’t see any pending requests in the getUserList() method for B user.

Solution:
In case, anyone faced this issue, I write below line after creating roster object:

roster?.subscriptionMode = Roster.SubscriptionMode.manual

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