Sfoglia il codice sorgente

1.修改调用的心跳方法。

2.修改MainActivity启动的WebsocketService
master
wangwanlei 10 mesi fa
parent
commit
70bd2c49e8

+ 2
- 2
app/src/main/java/com/xhly/manageapp/ui/MainActivity.kt Vedi File

@@ -29,8 +29,8 @@ import com.xhly.manageapp.R
29 29
 import com.xhly.manageapp.broadcastreceiver.AppInstallReceiver
30 30
 import com.xhly.manageapp.databinding.ActivityMainBinding
31 31
 import com.xhly.manageapp.service.ManageAccessibilityService
32
+import com.xhly.manageapp.service.websocket.AppSocketService
32 33
 import com.xhly.manageapp.ui.login.activity.LoginActivity
33
-import com.xhly.websocket.utils.WebSocketUtils
34 34
 import java.util.Calendar
35 35
 
36 36
 
@@ -66,7 +66,7 @@ class MainActivity : BaseActivity<CommonBaseViewModel, ActivityMainBinding>() {
66 66
          使用情况权限
67 67
          val permissionIntent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
68 68
           startActivity(permissionIntent)*/
69
-        WebSocketUtils.openWebSocket(this)
69
+        AppSocketService.openWebSocket(this)
70 70
         // csdkManagerUtils.csdkManager.enableAccessibility("com.xhly.manageapp","com.xhly.manageapp.service.TestService",true)
71 71
     }
72 72
 

+ 1
- 2
websocket/src/main/java/com/xhly/websocket/service/LongConnService.java Vedi File

@@ -16,7 +16,6 @@ import com.neovisionaries.ws.client.WebSocketException;
16 16
 import com.neovisionaries.ws.client.WebSocketFactory;
17 17
 import com.neovisionaries.ws.client.WebSocketFrame;
18 18
 import com.xhly.corelib.utils.NetworkUtils;
19
-import com.xhly.websocket.utils.WebSocketUtils;
20 19
 
21 20
 import java.io.IOException;
22 21
 import java.util.List;
@@ -284,7 +283,7 @@ public abstract class LongConnService extends Service {
284 283
             return;
285 284
         }
286 285
         // 在客户端上增加重试的逻辑。先发送心跳包,在N秒内若没有收到回复,则再发送一次。重试M次。
287
-        WebSocketUtils.hearBeat(webSocket);
286
+        WebSocketHelper.getInstance().hearBeat(webSocket);
288 287
         HEART_NOT_RECEIVE_TIME++;
289 288
         HAS_HEART_RECEIVE = false;
290 289
     }

Loading…
Annulla
Salva