断线Log:
08-21 17:20:17.222 27793-28054/com.lcw.des D/FA: Connected to remote service
08-21 17:20:17.223 27793-28054/com.lcw.des V/FA: Processing queued up service tasks: 2
08-21 17:20:22.326 27793-28054/com.lcw.des V/FA: Inactivity, disconnecting from the service
08-21 17:21:15.567 27793-27963/com.lcw.des D/AVStandardWebSocketClient: send ping packet
08-21 17:21:15.644 27793-27954/com.lcw.des D/AVStandardWebSocketClient: onWebsocketPong()
08-21 17:21:15.704 27793-27954/com.lcw.des D/AVStandardWebSocketClient: onWebsocketPong()
08-21 17:21:17.201 27793-27793/com.lcw.des D/PushService: PushService#onDestroy
08-21 17:21:17.204 27793-27793/com.lcw.des D/AVStandardWebSocketClient: onClose code=1006, message=Connectivity broken
08-21 17:21:17.206 27793-27793/com.lcw.des D/AVConnectionManager: webSocket closed...
-------------------------------------------------------------------------------------------------------分割线
-------------------------------------------------------------------------------------------------------分割线
APP再次进入前台Log:
08-21 17:24:52.155 27793-28202/com.lcw.des V/FA: Connecting to remote service
08-21 17:24:52.157 27793-27793/com.lcw.des D/lkj: com.lcw.app.ui.HomeActivity::updateUnreadMsg@244>>>HomeActivity:updateUnreadMsg:unRead:
08-21 17:24:52.165 27793-28202/com.lcw.des V/FA: Activity resumed, time: 359299701
08-21 17:24:52.254 27793-28202/com.lcw.des D/FA: Connected to remote service
08-21 17:24:52.254 27793-28202/com.lcw.des V/FA: Processing queued up service tasks: 1
08-21 17:24:57.262 27793-28202/com.lcw.des V/FA: Inactivity, disconnecting from the service
没有重连成功的迹象
-------------------------------------------------------------------------------------------------------分割线
-------------------------------------------------------------------------------------------------------分割线
查询聊天记录的时候的log:
08-21 17:26:49.894 27793-27793/com.lcw.des W/Choreographer: OPTS_INPUT: First frame was drawed before optimized, so skip!
08-21 17:26:50.411 27793-27793/com.lcw.des D/PushService: PushService#onCreate
08-21 17:26:50.414 27793-28242/com.lcw.des D/AVConnectionManager: start connection...
08-21 17:26:50.415 27793-28242/com.lcw.des D/AppRouter: fetchRTMServerFromRemote. router=https://ezjo8bev.rtm.lncld.net, appId=ezJO8BEv2tFIOaz0IcGWIjn4-gzGzoHsz
08-21 17:26:50.420 27793-27793/com.lcw.des D/PushService: PushService#onStartCommand
08-21 17:26:50.422 27793-27793/com.lcw.des D/PushService: networking is fine and try to start connection to leancloud.
08-21 17:26:50.422 27793-27793/com.lcw.des D/AVConnectionManager: on starting connection, save callback...
08-21 17:26:50.424 27793-27793/com.lcw.des D/PushService: PushService#onStartCommand
08-21 17:26:50.426 27793-27793/com.lcw.des D/PushService: networking is fine and try to start connection to leancloud.
08-21 17:26:50.426 27793-27793/com.lcw.des D/AVConnectionManager: on starting connection, save callback...
08-21 17:26:50.430 27793-27793/com.lcw.des D/PushService: Connection resumed with Wifi...
08-21 17:26:50.430 27793-27793/com.lcw.des D/AVConnectionManager: on starting connection, ignore.
08-21 17:26:52.492 27793-28243/com.lcw.des D/LoggingInterceptor: Request: curl -X GET
https://ezjo8bev.rtm.lncld.net/v1/route?appId=ezJO8BEv2tFIOaz0IcGWIjn4-gzGzoHsz&installationId=ebeb1a08b45ab448e4c42ed4fa825d0a&secure=1
08-21 17:26:52.494 27793-28243/com.lcw.des D/LoggingInterceptor: Response: 200
server: nginx
date: Wed, 21 Aug 2019 09:26:52 GMT
content-type: application/json
content-length: 175
vary: Accept-Encoding
{"groupId":"g0","server":"wss:\/\/cn-n1-cell7.leancloud.cn\/","ttl":14400,"secondary":"wss:\/\/cn-n1-cell5.avoscloud.com\/","groupUrl":"https:\/\/router-g0-push.leancloud.cn"}
08-21 17:26:52.500 27793-27793/com.lcw.des D/AVConnectionManager: try to connect server: wss://cn-n1-cell5.avoscloud.com/
08-21 17:26:53.306 27793-28251/com.lcw.des D/AVStandardWebSocketClient: onOpen status=101, statusMsg=Switching Protocols
08-21 17:26:53.306 27793-28251/com.lcw.des D/AVConnectionManager: webSocket established...
08-21 17:26:53.308 27793-27793/com.lcw.des D/PushService: processIMRequests...
processIMRequestsFromClient...
08-21 17:26:53.309 27793-28251/com.lcw.des D/AVStandardWebSocketClient: uplink : cmd: login
appId: "ezJO8BEv2tFIOaz0IcGWIjn4-gzGzoHsz"
installationId: "ebeb1a08b45ab448e4c42ed4fa825d0a"
08-21 17:26:53.315 27793-27793/com.lcw.des D/AVSession: offer operation with requestId=-65525, selfId=201711270000008
08-21 17:26:53.320 27793-27793/com.lcw.des D/AVStandardWebSocketClient: uplink : cmd: conv
op: query
i: -65525
convMessage {
limit: 20
flag: 2
}
08-21 17:26:54.633 27793-28251/com.lcw.des D/AVConnectionManager: downlink: cmd: error
i: -65525
service: 2
errorMessage {
code: 4105
reason: "SESSION_REQUIRED"
}
08-21 17:26:54.633 27793-28251/com.lcw.des W/AVConnectionManager: no peer subscribed message, ignore it. peerId=201711270000008, requestKey=-65525
08-21 17:26:54.637 27793-28251/com.lcw.des D/AVConnectionManager: downlink: cmd: loggedin
installationId: "ebeb1a08b45ab448e4c42ed4fa825d0a"
service: 0
08-21 17:26:54.709 27793-27804/com.lcw.des I/zygote64: Background concurrent copying GC freed 36623(2033KB) AllocSpace objects, 15(444KB) LOS objects, 49% free, 7MB/15MB, paused 1.217ms total 101.853ms
08-21 17:27:03.327 27793-27793/com.lcw.des D/lkj: com.lcw.app.ui.lean.cloud.ConversationFragment$9::done@334>>>e2: 124--cn.leancloud.AVException: Timeout Exception
-------------------------------------------------------------------------------------------------------分割线
-------------------------------------------------------------------------------------------------------分割线
编译版本: API 28
开发工具: AndroidStudio
开发原因: 由Android旧版本升级到最新版本
测试版本: 最新版本 Java SDK 5.0.21
测试手机1: 小米MIX API 26 失败
测试手机2: 一加6 API 28 失败
-------------------------------------------------------------------------------------------------------分割线
-------------------------------------------------------------------------------------------------------分割线
附上调用失败的查询聊天记录的代码:
if (client != null && !loading) {
loading = true;
AVIMConversationsQuery query = client.getConversationsQuery();
// query.whereEqualTo("objectId", conversation.getConversationId());
// 按对话的创建时间降序
// query.orderByDescending("createdAt");
// query.orderByAscending("createdAt");
query.setWithLastMessagesRefreshed(true); //显示最后一条信息
query.setLimit(Constant.LIST_PAGE_SIZE);
query.setQueryPolicy(AVQuery.CachePolicy.NETWORK_ELSE_CACHE);
if (startSkip != 0) query.setSkip(startSkip);
query.findInBackground(new AVIMConversationQueryCallback() {
@Override
public void done(List convs, AVIMException e) {
if (e != null) {
Log.d("lkj", "e2: " + e.getCode() + "--" + e.getMessage());
}
hasNextPage = false;
loading = false;
conversationRefresh.setRefreshing(false);
if (e == null) {
if (convs != null && !convs.isEmpty()) {
conversationAdaper.update(convs);
if (convs.size() == Constant.LIST_PAGE_SIZE) hasNextPage = true;
}
}
if (cacheConversation != null && !cacheConversation.isEmpty()) {
for (AVIMConversation con : cacheConversation) {
conversationAdaper.addNewConversation(con);
}
cacheConversation.clear();
}
}
});
} else {
conversationRefresh.setRefreshing(false);
}
请问是我打开的方式不对吗?请求大神指教!