Although sendChatToGroup() works on a callback thread, it does not seem to work on a “fresh” thread. Similar for direct message.
You can validate this problem using the function attempt2chats() at bottom. A call to the function can be inserted around line 396 of the sample app’s MyMeetingActivity.java, after lines:
private void refreshToolbar() {
if (mMeetingService.getMeetingStatus() == MeetingStatus.MEETING_STATUS_INMEETING) {
That refreshToolbar() function is called during a callback from OnMeetingStatusChanged(), and as such, the calling thread supports outgoing chat. (If you want the full MyMeetingActivity file to test with, please contact me. Does zoom allow posting of such samples as a ‘gist’ publicly?)
Version
This applies to the Android SDK v5.9+, and probably before too (I recall seeing this behavior several releases ago).
Steps To Reproduce
- Insert attempt2chats() into sdk sample code as mentioned above
- Launch different (normal) client into meeting beforehand, to receive chats and validate.
- Join meeting with modified sample client
- Validate that group chat has one message, but not two.
- Validate there is no error result for 2nd attempt in separate, fresh thread; it is echoed to sending client but not to actual group chat.
Smartphone:
- Device: Pixel 1,3
- OS: android 10, 12 respectively
Additional context
Important: validate this with at least 2 attendees in the group chat; message is echoed to local sample client but NOT to others
=============
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
import us.zoom.sdk.MobileRTCSDKError;
import us.zoom.sdk.ZoomSDK;
import us.zoom.sdk.InMeetingChatController;
/**
* class which shows that zoom android SDK v5.9x cannot chat from fresh thread.
* insert call to this around line 396 of MyMeetingActivity.java, which has lines:
* private void refreshToolbar() {
* if (mMeetingService.getMeetingStatus() == MeetingStatus.MEETING_STATUS_INMEETING) {
*/
public class TwoChats {
private static final String TAG = "chatThreadIssue";
private void attempt2chats(Context context) {
// hack to test chat from zoom callback vs fresh thread
Toast.makeText(context, "attempting chat...", Toast.LENGTH_SHORT).show();
final MobileRTCSDKError result = ZoomSDK.getInstance().getInMeetingService()
.getInMeetingChatController()
.sendChatToGroup(
InMeetingChatController.MobileRTCChatGroup.MobileRTCChatGroup_All,
"test message in callback");
if (result != MobileRTCSDKError.SDKERR_SUCCESS) {
Toast.makeText(context, "chat error in callback: " + result, Toast.LENGTH_SHORT).show();
Log.d(TAG, "got chat err in callback: " + result);
}
Runnable freshThread = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000); // wait for previous chatting to be "not too frequent"
} catch (InterruptedException e) {
e.printStackTrace();
}
final MobileRTCSDKError result = ZoomSDK.getInstance().getInMeetingService()
.getInMeetingChatController()
.sendChatToGroup(
InMeetingChatController.MobileRTCChatGroup.MobileRTCChatGroup_All,
"test message in thread");
if (result != MobileRTCSDKError.SDKERR_SUCCESS) {
Log.d(TAG, "got chat err in thread: " + result);
}
}
} ;
new Thread(freshThread).start();
}
}