get weather info.
authorTrillGates <williamtrillgates@gmail.com>
Fri, 28 May 2021 09:45:22 +0000 (17:45 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 28 May 2021 09:45:22 +0000 (17:45 +0800)
app/src/main/java/com/enqualcomm/support/CoreService.java

index c7407a3..95c83cd 100644 (file)
@@ -1499,6 +1499,11 @@ public class CoreService extends Service {
                 ICLogger.i("retry  如果连接成功则停止重试!");
                 no_network_Heartbeats_Count = 0;
                 stopConnectionRetryTimer();
+                //连接成功,去获取一次天气
+                //如果防走丢的协议的话
+                if (Config.protocol_no == Config.PROTOCOL_FZD) {
+                    getFZDWeatherInfo();
+                }
             } else {
                 if (retry_connect_count >= retry_connect_max_times) {
 
@@ -1613,14 +1618,18 @@ public class CoreService extends Service {
 
         @Override
         public void loadWeatherInfo() {
-            //获取天气信息
-            StringMessage wt = protocol_fzd.WT(runtime);
-            connection.send(wt);
-            StringMessage wt2 = protocol_fzd.WT2(runtime);
-            connection.send(wt2);
+            getFZDWeatherInfo();
         }
     };
 
+    private void getFZDWeatherInfo() {
+        //获取天气信息
+        StringMessage wt = protocol_fzd.WT(runtime);
+        connection.send(wt);
+        StringMessage wt2 = protocol_fzd.WT2(runtime);
+        connection.send(wt2);
+    }
+
 
     private final IFZDService.Stub mFZDService = new IFZDService.Stub() {
         @Override