--> --> --> --> --> --> --> --> 这里是调用连接 --> --> --> --> --> --> --> --> --> --> -->
/**
* 连接聊天室
*
* @param avUser 用户对象
*/
private void connectClient(AVUser avUser) {
AVIMClientOpenOption option = new AVIMClientOpenOption();
option.setForceSingleLogin(true);
AVIMClient client = AVIMClient.getInstance(avUser);
client.open(option, new AVIMClientCallback() {
@Override
public void done(AVIMClient client, AVIMException e) {
activity.runOnUiThread(() -> {
if (e == null) {
loginSuccessNext(avUser, client);
Lgg.t(Cons.TAG).ii("Method--> " + getClass().getSimpleName() + ":client connect success--> clientId: " + "" + client.getClientId());
} else {
AVUser.logOut();
loginErrorNext(e);
Lgg.t(Cons.TAG).ii("Method--> " + getClass().getSimpleName() + ":client connect failed");
}
loginAfterNext();
});
}
});
}
--> --> --> --> --> --> --> --> --> 这里在application注册下线监听 --> --> --> --> --> --> -->
AVIMClient.setClientEventHandler(new AVIMClientEventHandler() {
@Override
public void onConnectionPaused(AVIMClient avimClient) {
Lgg.t(Cons.TAG).ii("onConnectionPaused");
}
@Override
public void onConnectionResume(AVIMClient avimClient) {
Lgg.t(Cons.TAG).ii("onConnectionResume");
}
@Override
public void onClientOffline(AVIMClient avimClient, int i) {
Lgg.t(Cons.TAG).ii("onClientOffline");
}
});
然后, 两部手机依然还是可以同时登陆, 没有任何一部收到下线通知, 没有Log打印, 请大神们帮忙...