From 0236b9ceee983c21a703f93d4e3f1592afcbbd2e Mon Sep 17 00:00:00 2001 From: snickersun Date: Mon, 13 Apr 2020 11:31:04 +0800 Subject: [PATCH] =?utf8?q?1=E3=80=81GPS=20=E5=B8=B8=E5=BC=80=E7=9A=84?= =?utf8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=AF=8F=E6=AC=A1?= =?utf8?q?=E6=B5=8B=E8=AF=95=E5=89=8D=E7=8A=B6=E6=80=81=E9=83=BD=E8=AE=BE?= =?utf8?q?=E7=BD=AE=E4=B8=BA=E6=9C=AA=E5=AE=9A=E4=BD=8D=EF=BC=8C=E4=BF=9D?= =?utf8?q?=E8=AF=81=E6=B2=A1=E4=BF=A1=E5=8F=B7=E6=97=B6=E7=8A=B6=E6=80=81?= =?utf8?q?=E5=8F=8A=E6=97=B6=E5=88=87=E6=8D=A2=E3=80=82=202=E3=80=81?= =?utf8?q?=E5=8E=BB=E6=8E=89ScreenOn=20Off=20=E6=97=B6=E5=AF=B9wifi?= =?utf8?q?=E7=9A=84=E6=93=8D=E4=BD=9C=EF=BC=8C=E6=9A=82=E6=97=B6=E4=B8=8D?= =?utf8?q?=E7=AE=A1=E5=AE=9A=E4=BD=8D=E4=BB=A5=E5=A4=96=E7=9A=84wifi?= =?utf8?q?=E7=8A=B6=E6=80=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../main/java/com/enqualcomm/support/CoreService.java | 8 ++++++-- .../main/java/com/enqualcomm/support/LocationClient.java | 9 +++++---- .../main/java/com/enqualcomm/support/NMEAListener.java | 4 ++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index ad6766c2..99860d6e 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -330,13 +330,17 @@ public class CoreService extends Service { if (CoreService.is_wifi_network_ok) { CoreService.is_wifi_network_ok = false; /*屏幕亮起时,如果wifi用户设置是开启的,则开启wifi*/ - Util.turnOnWifiForConnect(runtime.getContextProxy().context, runtime); +// ICLogger.i("turnOnWifiForConnect"); +// if (!Util.isWifiIsOpen(runtime.getContextProxy().context,runtime)) +// Util.turnOnWifiForConnect(runtime.getContextProxy().context, runtime); } } else if ("android.intent.action.SCREEN_OFF".equals(param1Intent.getAction()) && Util.isWifiIsOpen(runtime.getContextProxy().context,runtime)) { // CoreService.is_wifi_network_ok = true; if (!runtime.isNoTurnOffWifiOnScreenOff()) { //不关闭wifi when ScreenOff - Util.turnOffWifiForSleep(runtime.getContextProxy().context, runtime); + ICLogger.i("turnOffWifiForConnect"); +// if (Util.isWifiIsOpen(runtime.getContextProxy().context,runtime)) +// Util.turnOffWifiForSleep(runtime.getContextProxy().context, runtime); } } } diff --git a/app/src/main/java/com/enqualcomm/support/LocationClient.java b/app/src/main/java/com/enqualcomm/support/LocationClient.java index 6b39500e..b7146948 100644 --- a/app/src/main/java/com/enqualcomm/support/LocationClient.java +++ b/app/src/main/java/com/enqualcomm/support/LocationClient.java @@ -249,6 +249,7 @@ public class LocationClient { } else { ICLogger.i("GPS is still listening, skip open it!"); + runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN); //此处为了检测是否定位时可以正确识别状态,以防一直处于GPS定位成功状态 if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", "GPS is still listening, skip open it!"); } }else{ @@ -451,9 +452,10 @@ public class LocationClient { } break; } - - if(needCheckAgain) - AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context,1,ACTION_CHECK_LOCATION_RESULT); + ICLogger.i("needCheckAgain "+needCheckAgain); + if(needCheckAgain) { + AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context, 1, ACTION_CHECK_LOCATION_RESULT); + } } public void stopCheckLocationResult(){ @@ -601,7 +603,6 @@ public void updateCellInfo() { break; } - startCheckResult(); } diff --git a/app/src/main/java/com/enqualcomm/support/NMEAListener.java b/app/src/main/java/com/enqualcomm/support/NMEAListener.java index be34aa4c..4aeff352 100644 --- a/app/src/main/java/com/enqualcomm/support/NMEAListener.java +++ b/app/src/main/java/com/enqualcomm/support/NMEAListener.java @@ -533,6 +533,7 @@ public class NMEAListener implements NmeaListener, LocationListener { if (this.listening == false) { Settings.Secure.setLocationProviderEnabled(runtime.getContextProxy().getResolver(), GPS_PROVIDER, true); + runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_OPEN); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE);// 设置为最大精度 @@ -564,6 +565,9 @@ public class NMEAListener implements NmeaListener, LocationListener { return true;//gpsHotStart(); } else { ICLogger.i(" location listening, skip !"); + + runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_SEARCHING); + if (Config.LOG_TOFILE) ICLogger.logToFile("GPS", " location listening, skip !"); return true; -- 2.17.1