io.rong.imlib.RongIMClient Java Examples
The following examples show how to use
io.rong.imlib.RongIMClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RongYunModel.java From Fishing with GNU General Public License v3.0 | 6 votes |
public void joinGroup(Context context,String groupId,String groupName) { /** * 加入群组。 * * @param groupId 群组 Id。 * @param groupName 群组名称。 * @param callback 加入群组状态的回调。 */ RongIM.getInstance().getRongIMClient().joinGroup(groupId, groupName, new RongIMClient.OperationCallback() { @Override public void onSuccess() { JUtils.Toast("加入群组成功"); chatGroup(context,groupId,groupName); } @Override public void onError(RongIMClient.ErrorCode errorCode) { JUtils.Toast("加入群组失败"); } }); }
Example #2
Source File: SessionAtPresenter.java From LQRWeChat with MIT License | 6 votes |
private void updateMessageStatus(int messageId) { RongIMClient.getInstance().getMessage(messageId, new RongIMClient.ResultCallback<Message>() { @Override public void onSuccess(Message message) { for (int i = 0; i < mData.size(); i++) { Message msg = mData.get(i); if (msg.getMessageId() == message.getMessageId()) { mData.remove(i); mData.add(i, message); mAdapter.notifyDataSetChangedWrapper(); break; } } } @Override public void onError(RongIMClient.ErrorCode errorCode) { } }); }
Example #3
Source File: SessionAtPresenter.java From LQRWeChat with MIT License | 6 votes |
public void getLocalHistoryMessage() { //没有消息第一次调用应设置为:-1。 int messageId = -1; if (mData.size() > 0) { messageId = mData.get(0).getMessageId(); } else { messageId = -1; } RongIMClient.getInstance().getHistoryMessages(mConversationType, mSessionId, messageId, mMessageCount, new RongIMClient.ResultCallback<List<Message>>() { @Override public void onSuccess(List<Message> messages) { getView().getRefreshLayout().endRefreshing(); if (messages == null || messages.size() == 0) getRemoteHistoryMessages(); else saveHistoryMsg(messages); } @Override public void onError(RongIMClient.ErrorCode errorCode) { getView().getRefreshLayout().endRefreshing(); loadMessageError(errorCode); } }); }
Example #4
Source File: MainPageActivity.java From sealrtc-android with MIT License | 6 votes |
private boolean initSDK() { if (TextUtils.isEmpty(SessionManager.getInstance().getString(APP_KEY))) return false; if (mStatus < STATE_INIT) { mStatus = STATE_INIT; /* * 如果是连接到私有云需要在此配置服务器地址 * 如果是公有云则不需要调用此方法 */ RongIMClient.setServerInfo(SessionManager.getInstance().getString(APP_KEY), UserUtils.FILE_SERVER); RongIMClient.init(getApplication(), ServerUtils.getAppKey(), false); /* * 设置建立 Https 连接时,是否使用自签证书。 * 公有云用户无需调用此方法,私有云用户使用自签证书时调用此方法设置 */ /*configBuilder = new RongRTCConfig.Builder(); configBuilder.enableHttpsSelfCertificate(true);*/ // Jenkins 配置 Meida Server 地址 if (!TextUtils.isEmpty(UserUtils.MEDIA_SERVER) && UserUtils.MEDIA_SERVER.startsWith("http")) { RongMediaSignalClient.setMediaServerUrl(UserUtils.MEDIA_SERVER); } } return true; }
Example #5
Source File: MyApp.java From LQRWeChat with MIT License | 6 votes |
private void initRongCloud() { /** * OnCreate 会被多个进程重入,这段保护代码,确保只有您需要使用 RongIMClient 的进程和 Push 进程执行了 init。 * io.rong.push 为融云 push 进程名称,不可修改。 */ if (getApplicationInfo().packageName.equals(getCurProcessName(getApplicationContext())) || "io.rong.push".equals(getCurProcessName(getApplicationContext()))) { RongIMClient.init(this); } //监听接收到的消息 RongIMClient.setOnReceiveMessageListener(this); try { RongIMClient.registerMessageType(RedPacketMessage.class); RongIMClient.registerMessageType(DeleteContactMessage.class); } catch (AnnotationNotFoundException e) { e.printStackTrace(); } }
Example #6
Source File: RecentMessageFgPresenter.java From LQRWeChat with MIT License | 6 votes |
private void loadData() { RongIMClient.getInstance().getConversationList(new RongIMClient.ResultCallback<List<Conversation>>() { @Override public void onSuccess(List<Conversation> conversations) { if (conversations != null && conversations.size() > 0) { mData.clear(); mData.addAll(conversations); filterData(mData); } } @Override public void onError(RongIMClient.ErrorCode errorCode) { LogUtils.e("加载最近会话失败:" + errorCode); } }); }
Example #7
Source File: SessionAtPresenter.java From LQRWeChat with MIT License | 6 votes |
public void getRemoteHistoryMessages() { //消息中的 sentTime;第一次可传 0,获取最新 count 条。 long dateTime = 0; if (mData.size() > 0) { dateTime = mData.get(0).getSentTime(); } else { dateTime = 0; } RongIMClient.getInstance().getRemoteHistoryMessages(mConversationType, mSessionId, dateTime, mMessageCount, new RongIMClient.ResultCallback<List<Message>>() { @Override public void onSuccess(List<Message> messages) { saveHistoryMsg(messages); } @Override public void onError(RongIMClient.ErrorCode errorCode) { loadMessageError(errorCode); } }); }
Example #8
Source File: RongRTCApplication.java From sealrtc-android with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); Utils.init(this); // bugly 配置,查看对应崩溃日志。 String processName = Utils.getCurProcessName(this); // 设置是否为上报进程 CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(this); strategy.setUploadProcess(processName.equals(getPackageName())); // 初始化Bugly CrashReport.initCrashReport(this, "3612cc23a8", false, strategy); if (getApplicationInfo().packageName.equals(Utils.getCurProcessName(this))) { try { RongIMClient.registerMessageType(RoomInfoMessage.class); RongIMClient.registerMessageType(WhiteBoardInfoMessage.class); RongIMClient.registerMessageType(RoomKickOffMessage.class); } catch (AnnotationNotFoundException e) { e.printStackTrace(); } // 相芯SDK 初始化 FURenderer.initFURenderer(this); } registerLifecycleCallbacks(); }
Example #9
Source File: SessionInfoAtPresenter.java From LQRWeChat with MIT License | 6 votes |
public void clearConversationMsg() { mContext.showMaterialDialog(null, UIUtils.getString(R.string.are_you_sure_to_clear_msg_record), UIUtils.getString(R.string.clear), UIUtils.getString(R.string.cancel) , v1 -> RongIMClient.getInstance().clearMessages(mConversationType, mSessionId, new RongIMClient.ResultCallback<Boolean>() { @Override public void onSuccess(Boolean aBoolean) { mContext.hideMaterialDialog(); BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.UPDATE_CONVERSATIONS); BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.REFRESH_CURRENT_SESSION); } @Override public void onError(RongIMClient.ErrorCode errorCode) { mContext.hideMaterialDialog(); } }), v2 -> mContext.hideMaterialDialog()); }
Example #10
Source File: SessionActivity.java From LQRWeChat with MIT License | 6 votes |
@Override public void init() { Intent intent = getIntent(); mSessionId = intent.getStringExtra("sessionId"); int sessionType = intent.getIntExtra("sessionType", SESSION_TYPE_PRIVATE); switch (sessionType) { case SESSION_TYPE_PRIVATE: mConversationType = Conversation.ConversationType.PRIVATE; break; case SESSION_TYPE_GROUP: mConversationType = Conversation.ConversationType.GROUP; break; } initAudioRecordManager(); //设置会话已读 RongIMClient.getInstance().clearMessagesUnreadStatus(mConversationType, mSessionId); registerBR(); }
Example #11
Source File: SettingActivity.java From LQRWeChat with MIT License | 6 votes |
@Override public void initListener() { mOivAbout.setOnClickListener(v -> jumpToActivity(AboutActivity.class)); mOivHelpFeedback.setOnClickListener(v1 -> jumpToWebViewActivity(AppConst.WeChatUrl.HELP_FEED_BACK)); mOivExit.setOnClickListener(v -> { if (mExitView == null) { mExitView = View.inflate(this, R.layout.dialog_exit, null); mExitDialog = new CustomDialog(this, mExitView, R.style.MyDialog); mExitView.findViewById(R.id.tvExitAccount).setOnClickListener(v1 -> { RongIMClient.getInstance().logout(); UserCache.clear(); mExitDialog.dismiss(); MyApp.exit(); jumpToActivityAndClearTask(LoginActivity.class); }); mExitView.findViewById(R.id.tvExitApp).setOnClickListener(v1 -> { RongIMClient.getInstance().disconnect(); mExitDialog.dismiss(); MyApp.exit(); }); } mExitDialog.show(); }); }
Example #12
Source File: OperationRong.java From sealtalk-android with MIT License | 6 votes |
public static void setConverstionNotif(final Context context, Conversation.ConversationType conversationType, String targetId, boolean state) { Conversation.ConversationNotificationStatus cns; if (state) { cns = Conversation.ConversationNotificationStatus.DO_NOT_DISTURB; } else { cns = Conversation.ConversationNotificationStatus.NOTIFY; } RongIM.getInstance().setConversationNotificationStatus(conversationType, targetId, cns, new RongIMClient.ResultCallback<Conversation.ConversationNotificationStatus>() { @Override public void onSuccess(Conversation.ConversationNotificationStatus conversationNotificationStatus) { if (conversationNotificationStatus == Conversation.ConversationNotificationStatus.DO_NOT_DISTURB) { // NToast.shortToast(context, "设置免打扰成功"); } else if (conversationNotificationStatus == Conversation.ConversationNotificationStatus.NOTIFY) { // NToast.shortToast(context, "取消免打扰成功"); } } @Override public void onError(RongIMClient.ErrorCode errorCode) { NToast.shortToast(context, "设置失败"); } }); }
Example #13
Source File: ConversationActivity.java From sealtalk-android with MIT License | 6 votes |
/** * 设置公共服务号 ActionBar */ private void setPublicServiceActionBar(String targetId) { if (targetId == null) return; RongIM.getInstance().getPublicServiceProfile(Conversation.PublicServiceType.PUBLIC_SERVICE , targetId, new RongIMClient.ResultCallback<PublicServiceProfile>() { @Override public void onSuccess(PublicServiceProfile publicServiceProfile) { getSupportActionBar().setTitle(publicServiceProfile.getName().toString()); } @Override public void onError(RongIMClient.ErrorCode errorCode) { } }); }
Example #14
Source File: CallActivity.java From sealrtc-android with MIT License | 6 votes |
private void audiolevel(final int val, final String key) { runOnUiThread(new Runnable() { @Override public void run() { if (null != renderViewManager && null != renderViewManager.connectedRemoteRenders && renderViewManager.getViewHolder(key) != null) { VideoViewManager.RenderHolder renderHolder = renderViewManager .getViewHolder(key); if (val > 0) { if (key.equals(RongIMClient.getInstance().getCurrentUserId()) && muteMicrophone) { renderHolder.coverView.closeAudioLevel(); } else { renderHolder.coverView.showAudioLevel(); } } else { renderHolder.coverView.closeAudioLevel(); } } } }); }
Example #15
Source File: RongYunModel.java From Fishing with GNU General Public License v3.0 | 6 votes |
public void connectRongYun1(String token) { RongIM.connect(token, new RongIMClient.ConnectCallback() { @Override public void onTokenIncorrect() { JUtils.Log("融云Token失效"); refreshToken(); } @Override public void onSuccess(String s) { JUtils.Log("融云连接成功"); setRongYun(); } @Override public void onError(RongIMClient.ErrorCode errorCode) { JUtils.Log("融云连接失败:" + errorCode.getValue() + ":" + errorCode.getMessage()); } }); }
Example #16
Source File: VideoCallInputProvider.java From sealtalk-android with MIT License | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode != Activity.RESULT_OK) { return; } final Conversation conversation = getCurrentConversation(); Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO); ArrayList<String> userIds = data.getStringArrayListExtra("invited"); userIds.add(RongIMClient.getInstance().getCurrentUserId()); intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase()); intent.putExtra("targetId", conversation.getTargetId()); intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName()); intent.putStringArrayListExtra("invitedUsers", userIds); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setPackage(getContext().getPackageName()); getContext().getApplicationContext().startActivity(intent); }
Example #17
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 6 votes |
public void onDisableCameraBtnClick(View view) { TextView text = (TextView) bottomButtonContainer.findViewById(R.id.rc_voip_disable_camera_text); String currentUserId = RongIMClient.getInstance().getCurrentUserId(); RongCallClient.getInstance().setEnableLocalVideo(view.isSelected()); if (view.isSelected()) { text.setText(R.string.rc_voip_disable_camera); if (localViewUserId.equals(currentUserId)) { localView.setVisibility(View.VISIBLE); } else { remoteViewContainer.findViewWithTag(currentUserId).setVisibility(View.VISIBLE); } } else { text.setText(R.string.rc_voip_enable_camera); if (localViewUserId.equals(currentUserId)) { localView.setVisibility(View.GONE); } else { remoteViewContainer.findViewWithTag(currentUserId).setVisibility(View.GONE); } } view.setSelected(!view.isSelected()); }
Example #18
Source File: MultiVideoCallActivity.java From sealtalk-android with MIT License | 6 votes |
public void onAddButtonClick(View view) { setShouldShowFloat(false); if(callSession.getConversationType().equals(Conversation.ConversationType.DISCUSSION)) { RongIMClient.getInstance().getDiscussion(callSession.getTargetId(), new RongIMClient.ResultCallback<Discussion>() { @Override public void onSuccess(Discussion discussion) { Intent intent = new Intent(MultiVideoCallActivity.this, CallSelectMemberActivity.class); ArrayList<String> added = new ArrayList<>(); List<CallUserProfile> list = RongCallClient.getInstance().getCallSession().getParticipantProfileList(); for (CallUserProfile profile : list) { added.add(profile.getUserId()); } intent.putStringArrayListExtra("allMembers", (ArrayList<String>)discussion.getMemberIdList()); intent.putStringArrayListExtra("invitedMembers", added); startActivityForResult(intent, 110); } @Override public void onError(RongIMClient.ErrorCode e) { } }); } }
Example #19
Source File: AudioCallInputProvider.java From sealtalk-android with MIT License | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode != Activity.RESULT_OK) { return; } final Conversation conversation = getCurrentConversation(); Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO); ArrayList<String> userIds = data.getStringArrayListExtra("invited"); userIds.add(RongIMClient.getInstance().getCurrentUserId()); intent.putExtra("conversationType", conversation.getConversationType().getName().toLowerCase()); intent.putExtra("targetId", conversation.getTargetId()); intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName()); intent.putStringArrayListExtra("invitedUsers", userIds); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setPackage(getContext().getPackageName()); getContext().getApplicationContext().startActivity(intent); }
Example #20
Source File: RongCallKit.java From sealtalk-android with MIT License | 6 votes |
/** * 开始多人通话。 * 返回当前会话用户列表提供者对象,用户拿到该对象后,异步从服务器取出当前会话用户列表后, * 调用提供者中的 onGotUserList 方法,填充 ArrayList<String> userIds 后,就会自动发起多人通话。 * * @param context 上下文 * @param conversationType 会话类型 * @param targetId 会话 id * @param mediaType 通话的媒体类型:CALL_MEDIA_TYPE_AUDIO, CALL_MEDIA_TYPE_VIDEO * @return 返回当前会话用户列表提供者对象 */ public static ICallUsersProvider startMultiCall(final Context context, final Conversation.ConversationType conversationType, final String targetId, final CallMediaType mediaType) { return new ICallUsersProvider() { @Override public void onGotUserList(ArrayList<String> userIds) { String action; if (mediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) { action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO; } else { action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO; } Intent intent = new Intent(action); userIds.add(RongIMClient.getInstance().getCurrentUserId()); intent.putExtra("conversationType", conversationType.getName().toLowerCase()); intent.putExtra("targetId", targetId); intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName()); intent.putStringArrayListExtra("invitedUsers", userIds); context.startActivity(intent); } }; }
Example #21
Source File: RongCallKit.java From sealtalk-android with MIT License | 6 votes |
/** * 发起多人通话 * * @param context 上下文 * @param conversationType 会话类型 * @param targetId 会话 id * @param mediaType 会话媒体类型 * @param userIds 参与者 id 列表 */ public static void startMultiCall(Context context, Conversation.ConversationType conversationType, String targetId, CallMediaType mediaType, ArrayList<String> userIds) { String action; if (mediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) { action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO; } else { action = RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO; } Intent intent = new Intent(action); userIds.add(RongIMClient.getInstance().getCurrentUserId()); intent.putExtra("conversationType", conversationType.getName().toLowerCase()); intent.putExtra("targetId", targetId); intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName()); intent.putStringArrayListExtra("invitedUsers", userIds); context.startActivity(intent); }
Example #22
Source File: ConversationActivity.java From sealtalk-android with MIT License | 6 votes |
@Override public void onStatusChange(final RealTimeLocationConstant.RealTimeLocationStatus status) { currentLocationStatus = status; EventBus.getDefault().post(status); if (status == RealTimeLocationConstant.RealTimeLocationStatus.RC_REAL_TIME_LOCATION_STATUS_IDLE) { hideRealTimeBar(); RealTimeLocationConstant.RealTimeLocationErrorCode errorCode = RongIMClient.getInstance().getRealTimeLocation(mConversationType, mTargetId); if (errorCode == RealTimeLocationConstant.RealTimeLocationErrorCode.RC_REAL_TIME_LOCATION_SUCCESS) { RongIM.getInstance().insertMessage(mConversationType, mTargetId, RongIM.getInstance().getCurrentUserId(), InformationNotificationMessage.obtain("位置共享已结束")); } } else if (status == RealTimeLocationConstant.RealTimeLocationStatus.RC_REAL_TIME_LOCATION_STATUS_OUTGOING) {//发自定义消息 showRealTimeLocationBar(status); } else if (status == RealTimeLocationConstant.RealTimeLocationStatus.RC_REAL_TIME_LOCATION_STATUS_INCOMING) { showRealTimeLocationBar(status); } else if (status == RealTimeLocationConstant.RealTimeLocationStatus.RC_REAL_TIME_LOCATION_STATUS_CONNECTED) { showRealTimeLocationBar(status); } }
Example #23
Source File: ConversationActivity.java From sealtalk-android with MIT License | 6 votes |
/** * 设置讨论组界面 ActionBar */ private void setDiscussionActionBar(String targetId) { if (targetId != null) { RongIM.getInstance().getDiscussion(targetId , new RongIMClient.ResultCallback<Discussion>() { @Override public void onSuccess(Discussion discussion) { getSupportActionBar().setTitle(discussion.getName()); } @Override public void onError(RongIMClient.ErrorCode e) { if (e.equals(RongIMClient.ErrorCode.NOT_IN_DISCUSSION)) { getSupportActionBar().setTitle("不在讨论组中"); isDiscussion = true; supportInvalidateOptionsMenu(); } } }); } else { getSupportActionBar().setTitle("讨论组"); } }
Example #24
Source File: ConversationActivity.java From sealtalk-android with MIT License | 6 votes |
/** * 设置应用公众服务界面 ActionBar */ private void setAppPublicServiceActionBar(String targetId) { if (targetId == null) return; RongIM.getInstance().getPublicServiceProfile(Conversation.PublicServiceType.APP_PUBLIC_SERVICE , targetId, new RongIMClient.ResultCallback<PublicServiceProfile>() { @Override public void onSuccess(PublicServiceProfile publicServiceProfile) { getSupportActionBar().setTitle(publicServiceProfile.getName()); } @Override public void onError(RongIMClient.ErrorCode errorCode) { } }); }
Example #25
Source File: ConversationActivity.java From sealtalk-android with MIT License | 5 votes |
private void joinRealTimeLocation() { RongIMClient.getInstance().joinRealTimeLocation(mConversationType, mTargetId); Intent intent = new Intent(ConversationActivity.this, RealTimeLocationActivity.class); intent.putExtra("conversationType", mConversationType.getValue()); intent.putExtra("targetId", mTargetId); startActivity(intent); }
Example #26
Source File: ConversationListActivity.java From sealtalk-android with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sp = getSharedPreferences("config",MODE_PRIVATE); mDialog = new LoadingDialog(this); Intent intent = getIntent(); //push if (intent.getData().getScheme().equals("rong") && intent.getData().getQueryParameter("push") != null) { //通过intent.getData().getQueryParameter("push") 为true,判断是否是push消息 if (intent.getData().getQueryParameter("push").equals("true")) { String id = intent.getData().getQueryParameter("pushId"); enterActivity(); } } else {//通知过来 //程序切到后台,收到消息后点击进入,会执行这里 if (RongIM.getInstance().getCurrentConnectionStatus().equals(RongIMClient.ConnectionStatusListener.ConnectionStatus.DISCONNECTED)) { enterActivity(); } else { startActivity(new Intent(ConversationListActivity.this, MainActivity.class)); finish(); } } }
Example #27
Source File: ConversationActivity.java From sealtalk-android with MIT License | 5 votes |
private void startRealTimeLocation() { RongIMClient.getInstance().startRealTimeLocation(mConversationType, mTargetId); Intent intent = new Intent(ConversationActivity.this, RealTimeLocationActivity.class); intent.putExtra("conversationType", mConversationType.getValue()); intent.putExtra("targetId", mTargetId); startActivity(intent); }
Example #28
Source File: MembersDialog.java From sealrtc-android with MIT License | 5 votes |
public void bind(final ItemModel model) { ItemModel itemModel = model; StringBuilder builder = new StringBuilder(itemModel.name) .append("(") .append(itemModel.mode) .append(")"); nameTextView.setText(builder.toString()); if (RongIMClient.getInstance().getCurrentUserId().equals(adminUserId)) { if (!itemModel.userId.equals(adminUserId)) { memberOperateTextView.setText(R.string.member_operate_remove); memberOperateTextView.setTextColor( getActivity().getResources().getColor(R.color.blink_text_green)); memberOperateTextView.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (kickUserListener != null) { kickUserListener.onKick(model.userId, model.name); } } }); } } else { memberOperateTextView.setText(null); memberOperateTextView.setOnClickListener(null); } if (itemModel.userId.equals(adminUserId)) { memberOperateTextView.setText(R.string.member_operate_admin); memberOperateTextView.setTextColor( getActivity().getResources().getColor(R.color.colorWhite)); memberOperateTextView.setOnClickListener(null); } }
Example #29
Source File: MainAtPresenter.java From LQRWeChat with MIT License | 5 votes |
/** * 建立与融云服务器的连接 * * @param token */ private void connect(String token) { if (UIUtils.getContext().getApplicationInfo().packageName.equals(MyApp.getCurProcessName(UIUtils.getContext()))) { /** * IMKit SDK调用第二步,建立与服务器的连接 */ RongIMClient.connect(token, new RongIMClient.ConnectCallback() { /** * Token 错误,在线上环境下主要是因为 Token 已经过期,您需要向 App Server 重新请求一个新的 Token */ @Override public void onTokenIncorrect() { LogUtils.e("--onTokenIncorrect"); } /** * 连接融云成功 * @param userid 当前 token */ @Override public void onSuccess(String userid) { LogUtils.e("--onSuccess---" + userid); BroadcastManager.getInstance(mContext).sendBroadcast(AppConst.UPDATE_CONVERSATIONS); } /** * 连接融云失败 * @param errorCode 错误码,可到官网 查看错误码对应的注释 */ @Override public void onError(RongIMClient.ErrorCode errorCode) { LogUtils.e("--onError" + errorCode); UIUtils.showToast(UIUtils.getString(R.string.disconnect_server)); } }); } }
Example #30
Source File: RealTimeLocationActivity.java From sealtalk-android with MIT License | 5 votes |
private void setParticipantTextView(int count) { if (count == -1) { final List<String> userIds = RongIMClient.getInstance().getRealTimeLocationParticipants(conversationType, targetId); if (userIds != null && userIds.size() > 0) { count = userIds.size(); } } mParticipantTextView.setText(String.format(" %1$d人在共享位置", count)); }