endian11
2019-12-30 302ab8c069827c399cdd2664c79126eda71fe2f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.anyun.im_lib.im;
 
import android.util.Log;
 
import com.anyun.im_lib.IMSClientFactory;
import com.anyun.im_lib.interf.IMSClientInteface;
 
import java.util.Vector;
 
import static android.content.ContentValues.TAG;
 
/**
 * MyApplication2
 * Created by lzw on 2019/12/2. 11:56:55
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class IMSClientBootstrap {
 
    private static final IMSClientBootstrap INSTANCE= new IMSClientBootstrap();
    private IMSClientInteface imsClient;
 
    /**标记IMSClientBootstrap是否已经初始化**/
    private boolean isAlive;
 
    /**
     * 
     * @param userId
     * @param token
     * @param hosts
     * @param appStatus
     */
    public synchronized void init(String userId,String token,String hosts,int appStatus){
        if (!isAlive){
            Vector<String> serverUrlList = convertHosts(hosts);
            if (serverUrlList == null || serverUrlList.size() ==0){
                Log.i(TAG, "init IMLibClientBootstrap error,ims hosts is null");
                return;
            }
            isAlive = true;
            Log.i(TAG, "init IMLibClientBootstrap ,server="+hosts);
        }
        if (null != imsClient){
            imsClient.close();
        }
        //初始化IMSClientInteface
        imsClient = IMSClientFactory.getIMSClient();
        updateAppStatus(appStatus);
//        imsClient.init(serverUrlList,new OnEventListener(userId,token),new IMSConnectStatusCallback());
    }
 
 
 
    private void updateAppStatus(int appStatus) {
    }
 
    private Vector<String> convertHosts(String hosts) {
        //TODO
        return null;
    }
}