/** 根据 targetid 和 ConversationType 进入到设置页面 */ private void enterSettingActivity() { if (mConversationType == Conversation.ConversationType.PUBLIC_SERVICE || mConversationType == Conversation.ConversationType.APP_PUBLIC_SERVICE) { RongIM.getInstance().startPublicServiceProfile(this, mConversationType, targetId); } else { // 通过targetId 和 会话类型 打开指定的设置页面 if (!TextUtils.isEmpty(targetId)) { Uri uri = Uri.parse("demo://" + getApplicationInfo().packageName) .buildUpon() .appendPath("conversationSetting") .appendPath(mConversationType.getName()) .appendQueryParameter("targetId", targetId) .build(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); startActivity(intent); // 当你刚刚创建完讨论组以后获得的是 targetIds } else if (!TextUtils.isEmpty(targetIds)) { UriFragment fragment = (UriFragment) getSupportFragmentManager().getFragments().get(0); fragment.getUri(); // 得到讨论组的 targetId targetId = fragment.getUri().getQueryParameter("targetId"); if (!TextUtils.isEmpty(targetId)) { Uri uri = Uri.parse("demo://" + getApplicationInfo().packageName) .buildUpon() .appendPath("conversationSetting") .appendPath(mConversationType.getName()) .appendQueryParameter("targetId", targetId) .build(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(uri); startActivity(intent); } else { WinToast.toast(RongActivity.this, "讨论组尚未创建成功"); } } } }
public void startConversationSystem( Context context, Conversation.ConversationType conversationType, String targetId, String title) { if (context != null && !TextUtils.isEmpty(targetId) && conversationType != null) { if (RongContext.getInstance() == null) { throw new ExceptionInInitializerError("RongCloud SDK not init"); } else { Uri uri = Uri.parse("rong://" + context.getApplicationInfo().processName + ".system") .buildUpon() .appendPath("conversation") .appendPath(conversationType.getName().toLowerCase()) .appendQueryParameter("targetId", targetId) .appendQueryParameter("title", title) .build(); context.startActivity(new Intent("android.intent.action.VIEW", uri)); } } else { throw new IllegalArgumentException(); } }