Zingworks-Sachin / twilio_chat_conversation

2 stars 3 forks source link

ListenerException when fetching messages #1

Open ChasakisD opened 1 year ago

ChasakisD commented 1 year ago

Describe the bug Calling getMessages() after initializeConversationClient() is generating a ListenerException: As far as I can see from the implementation it does not wait for the conversation to be synchronized.

com.twilio.conversations.ListenerException: Exception thrown by a listener. Your application might have a problem in listener implementation. Listeners must never throw uncaught exceptions. See 'Caused by:' below for more details.
E/AndroidRuntime(10108):    at java.lang.reflect.Constructor.newInstance0(Native Method)
E/AndroidRuntime(10108):    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
E/AndroidRuntime(10108):    at com.twilio.conversations.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:123)
E/AndroidRuntime(10108):    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
E/AndroidRuntime(10108):    at $Proxy3.onSuccess(Unknown Source)
E/AndroidRuntime(10108):    at com.twilio.conversations.internal.CallbackListenerForwarder$1.run(CallbackListenerForwarder.java:34)
E/AndroidRuntime(10108):    at android.os.Handler.handleCallback(Handler.java:942)
E/AndroidRuntime(10108):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10108):    at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(10108):    at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(10108):    at android.app.ActivityThread.main(ActivityThread.java:7872)
E/AndroidRuntime(10108):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10108):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(10108):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(10108): Caused by: java.lang.IllegalStateException: Messages are not available at the moment. Synchronize the conversation first.
E/AndroidRuntime(10108):    at com.twilio.conversations.ConversationImpl.getMessages(ConversationImpl.java:214)
E/AndroidRuntime(10108):    at com.twilio.conversations.ConversationImpl.getLastMessages(ConversationImpl.java:280)
E/AndroidRuntime(10108):    at com.example.twilio_chat_conversation.Conversation.ConversationHandler$7.onSuccess(ConversationHandler.java:256)
E/AndroidRuntime(10108):    at com.example.twilio_chat_conversation.Conversation.ConversationHandler$7.onSuccess(ConversationHandler.java:253)
E/AndroidRuntime(10108):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10108):    at com.twilio.conversations.internal.RethrowingForwarder$RethrowingProxy.invoke(RethrowingForwarder.java:121)
E/AndroidRuntime(10108):    ... 11 more

Expected behavior Messages should be retrieved from conversation.

Smartphone (please complete the following information):

sachinpandit1000 commented 1 year ago

@ChasakisD Thanks for pointing this out. Will look into this issue. Can you please provide few more details/scenario so that I can reproduce this issue at my end? Do refer the sample code to check if that helps.

Gaurav-CareMonitor commented 7 months ago

Any updates on this @sachinpandit1000 ?

Gaurav-CareMonitor commented 7 months ago

Replicable in example app as well

HiraGul commented 4 months ago

Any Updates @ChasakisD? Did you resolve this?