Java Code Examples for io.rong.imlib.RongIMClient#init()

The following examples show how to use io.rong.imlib.RongIMClient#init() . 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: MainPageActivity.java    From sealrtc-android with MIT License 6 votes vote down vote up
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 2
Source File: MyApp.java    From LQRWeChat with MIT License 6 votes vote down vote up
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 3
Source File: MainPageActivity.java    From sealrtc-android with MIT License 5 votes vote down vote up
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
public void onBusComplaint(String val) {
    if (val.equals("ServerConfigActivity")) {
        RongIMClient.getInstance().switchAppKey(ServerUtils.getAppKey());
        RongIMClient.setServerInfo(ServerUtils.getNavServer(), UserUtils.FILE_SERVER);
        RongIMClient.init(getApplication(), ServerUtils.getAppKey(), false);
        showToast(getString(R.string.update_configuration_successful));
    }
}