0

I'm developing one app that uses Twilio for video calls and chats. The problem I'm having is that onParticipantAdded is never triggered, even though I successfully register ConversationListener. I know that I've successfully registered ConversationListener, because my onMessageAdded is always triggered when expected, but onParticipantAdded (from the same listener) is never called.

From the code perspective, there is not much to share, I have ConversationListener defined as

private val conversationListener: ConversationListener = object : ConversationListener {
    override fun onMessageAdded(message: Message?) {
        Timber.d("Message added")
    }

    override fun onMessageUpdated(message: Message, updateReason: Message.UpdateReason?) {
        Timber.d("Message updated: " + message.messageBody)
    }

    override fun onMessageDeleted(message: Message?) {
        Timber.d("Message deleted")
    }

    override fun onParticipantAdded(participant: Participant) {
        Timber.d("Participant added: " + participant.identity)
    }
...

I register this listener with

conversation.addListener(conversationListener)

In my logs, I see "Message added" every time someone sends a message, but "Participant added" is never printed in logs, even though participants are leaving and entering the conversation.

Any ideas of what can be the problem here?

Ban Markovic
  • 690
  • 1
  • 7
  • 12
  • Can you share the code you are using to connect to the Twilio SDKs and register the listeners? – philnash Oct 27 '21 at 01:33
  • I've put a code snippet in my description – Ban Markovic Oct 27 '21 at 07:05
  • A participant should only trigger `onParticipantAdded` when they are initially created and will trigger `onParticipantDeleted` when they are removed from a conversation (see [the docs here](https://www.twilio.com/docs/conversations/api/conversation-participant-resource)). When you say that "participants are leaving and entering", what do you mean exactly? – philnash Oct 27 '21 at 07:12
  • Well, I suspect that onParticipantAdded should be triggered when other user joins the conversation: conversation.join(object : StatusListener {...}) – Ban Markovic Oct 27 '21 at 10:52
  • Are you expecting onParticipantAdded to be triggered in the same application in which you call conversation.join? Or are you joining in one app and waiting for the event in another? – philnash Oct 27 '21 at 11:23
  • Yeah, I'm expecting the event to be triggered for another user who has listeners on the same conversation. So when user A joins the conversation, I'm expecting user B to receive onParticipantAdded callback. – Ban Markovic Oct 27 '21 at 11:31
  • Out of interest, are you able to run the [Conversations QuickStart application](https://www.twilio.com/docs/conversations/android/exploring-conversations-android-quickstart) and observe the behaviour you are talking about? – philnash Oct 27 '21 at 23:57

0 Answers0