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;
|
}
|
}
|