1、GPS 常开的时候,确保每次测试前状态都设置为未定位,保证没信号时状态及时切换。
authorsnickersun <scy@incartech.cn>
Mon, 13 Apr 2020 03:31:04 +0000 (11:31 +0800)
committersnickersun <scy@incartech.cn>
Mon, 13 Apr 2020 03:31:04 +0000 (11:31 +0800)
2、去掉ScreenOn Off 时对wifi的操作,暂时不管定位以外的wifi状态。

app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/LocationClient.java
app/src/main/java/com/enqualcomm/support/NMEAListener.java

index ad6766c..99860d6 100644 (file)
@@ -330,13 +330,17 @@ public class CoreService extends Service {
                 if (CoreService.is_wifi_network_ok) {\r
                     CoreService.is_wifi_network_ok = false;\r
                     /*屏幕亮起时,如果wifi用户设置是开启的,则开启wifi*/\r
-                    Util.turnOnWifiForConnect(runtime.getContextProxy().context, runtime);\r
+//                    ICLogger.i("turnOnWifiForConnect");\r
+//                    if (!Util.isWifiIsOpen(runtime.getContextProxy().context,runtime))\r
+//                        Util.turnOnWifiForConnect(runtime.getContextProxy().context, runtime);\r
                 }\r
             } else if ("android.intent.action.SCREEN_OFF".equals(param1Intent.getAction()) && Util.isWifiIsOpen(runtime.getContextProxy().context,runtime)) {\r
                // CoreService.is_wifi_network_ok = true;\r
                 if (!runtime.isNoTurnOffWifiOnScreenOff()) {\r
                     //不关闭wifi when ScreenOff\r
-                    Util.turnOffWifiForSleep(runtime.getContextProxy().context, runtime);\r
+                    ICLogger.i("turnOffWifiForConnect");\r
+//                    if (Util.isWifiIsOpen(runtime.getContextProxy().context,runtime))\r
+//                        Util.turnOffWifiForSleep(runtime.getContextProxy().context, runtime);\r
                 }\r
             }\r
         }\r
index 6b39500..b714694 100644 (file)
@@ -249,6 +249,7 @@ public class LocationClient {
 \r
         } else {\r
           ICLogger.i("GPS is still listening, skip open it!");\r
+          runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN); //此处为了检测是否定位时可以正确识别状态,以防一直处于GPS定位成功状态\r
           if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", "GPS is still listening, skip open it!");\r
         }\r
       }else{\r
@@ -451,9 +452,10 @@ public class LocationClient {
             }\r
             break;\r
         }\r
-\r
-        if(needCheckAgain)\r
-          AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context,1,ACTION_CHECK_LOCATION_RESULT);\r
+        ICLogger.i("needCheckAgain "+needCheckAgain);\r
+        if(needCheckAgain) {\r
+          AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context, 1, ACTION_CHECK_LOCATION_RESULT);\r
+        }\r
   }\r
 \r
   public void stopCheckLocationResult(){\r
@@ -601,7 +603,6 @@ public void updateCellInfo() {
 \r
         break;\r
     }\r
-\r
       startCheckResult();\r
   }\r
 \r
index be34aa4..4aeff35 100644 (file)
@@ -533,6 +533,7 @@ public class NMEAListener implements NmeaListener, LocationListener {
     if (this.listening == false) {\r
       Settings.Secure.setLocationProviderEnabled(runtime.getContextProxy().getResolver(), GPS_PROVIDER, true);\r
 \r
+      runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN);\r
 \r
       Criteria criteria = new Criteria();\r
       criteria.setAccuracy(Criteria.ACCURACY_FINE);// 设置为最大精度\r
@@ -564,6 +565,9 @@ public class NMEAListener implements NmeaListener, LocationListener {
       return true;//gpsHotStart();\r
     } else {\r
       ICLogger.i(" location listening, skip !");\r
+\r
+      runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_SEARCHING);\r
+\r
       if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", " location listening, skip !");\r
 \r
       return true;\r