AA-解决定时定位bug
authork.liang <liangkang648253071@126.com>
Fri, 22 Oct 2021 12:13:55 +0000 (20:13 +0800)
committerk.liang <liangkang648253071@126.com>
Fri, 22 Oct 2021 12:13:55 +0000 (20:13 +0800)
app/release/output.json
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/utils/AlarmWakeUp.java
app/src/main/java/com/ic/protocols/protocol_anan.java
app/version_code.properties
local.properties

index f4a9a22..9e205da 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":984,"versionName":"2110221046","enabled":true,"outputFile":"ICSer_V984_2110221046_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V984_2110221046_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":988,"versionName":"2110222005","enabled":true,"outputFile":"ICSer_V988_2110222005_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V988_2110222005_release.apk","properties":{}}]
\ No newline at end of file
index 3080584..8327c70 100644 (file)
@@ -221,8 +221,9 @@ public class CoreService extends Service {
             setWeatherAlarm();
             runtime.getContextProxy().sendBroadcast(ACTION_ALARM_ALARM_CHANGE, runtime); //更新Alarm
             // setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
-            if (cmcm_call_eiot_into_powersave_mode() == 0)
+            if (cmcm_call_eiot_into_powersave_mode() == 0) {
                 AlarmWakeUp.isNeedWakeUpAlarm(runtime);
+            }
         }
     };
     private final BroadcastReceiver broadcastSOSReceiver = new BroadcastReceiver() {
index da199c4..43cef78 100644 (file)
@@ -16,28 +16,30 @@ import static com.enqualcomm.support.Constants.SERVICE_CLS_NAME;
 import static com.enqualcomm.support.Constants.SERVICE_PKG_NAME;\r
 \r
 public class AlarmWakeUp {\r
-  private static long lastAlarmTime;\r
-  \r
-  public static void isNeedWakeUpAlarm(Runtime runtime) {\r
-    long l = SystemClock.elapsedRealtime();\r
-//    int i = Config.getAlarmCycle(runtime.getContextProxy().context);\r
-    int i = Config.getLocationCycle(runtime.getContextProxy().context);\r
-    if (l - lastAlarmTime > ((i + 1) * 60 * 1000)) { //达到cycle时间则唤醒CoreService并发送定位消息\r
-      ComponentName componentName = new ComponentName(SERVICE_PKG_NAME, SERVICE_CLS_NAME);\r
-//      Intent intent = (new Intent(CoreService.ACTION_ALARM)).setComponent(componentName);\r
-      Intent intent = (new Intent(Constants.ACTION_LOCATION_ALARM)).setComponent(componentName);\r
-      (runtime.getContextProxy()).context.startService(intent);\r
-\r
-      StringBuilder stringBuilder = new StringBuilder();\r
-      stringBuilder.append("isNeedWakeUpAlarm currentTimeMillis=");\r
-      stringBuilder.append(l);\r
-      stringBuilder.append("---lastAlarmTime=");\r
-      stringBuilder.append(lastAlarmTime);\r
-      ICLogger.i("AlarmWakeUp "+ stringBuilder.toString());\r
-      if (Config.LOG_TOFILE) ICLogger.logToFile( "alarmCycle", stringBuilder.toString());\r
-    } \r
-  }\r
-  \r
-  public static void setAlarmWakeUpTime() { lastAlarmTime = SystemClock.elapsedRealtime(); }\r
+    private static long lastAlarmTime;\r
+\r
+    public static void isNeedWakeUpAlarm(Runtime runtime) {\r
+        long l = SystemClock.elapsedRealtime();\r
+        int i = Config.getLocationCycle(runtime.getContextProxy().context);\r
+        if (l - lastAlarmTime > ((i + 1) * 60 * 1000)) { //达到cycle时间则唤醒CoreService并发送定位消息\r
+            ComponentName componentName = new ComponentName(SERVICE_PKG_NAME, SERVICE_CLS_NAME);\r
+            Intent intent = (new Intent(Constants.ACTION_LOCATION_ALARM)).setComponent(componentName);\r
+            (runtime.getContextProxy()).context.startService(intent);\r
+\r
+            StringBuilder stringBuilder = new StringBuilder();\r
+            stringBuilder.append("isNeedWakeUpAlarm currentTimeMillis=");\r
+            stringBuilder.append(l);\r
+            stringBuilder.append("---lastAlarmTime=");\r
+            stringBuilder.append(lastAlarmTime);\r
+            ICLogger.i("AlarmWakeUp " + stringBuilder.toString());\r
+            if (Config.LOG_TOFILE) {\r
+                ICLogger.logToFile("alarmCycle", stringBuilder.toString());\r
+            }\r
+        }\r
+    }\r
+\r
+    public static void setAlarmWakeUpTime() {\r
+        lastAlarmTime = SystemClock.elapsedRealtime();\r
+    }\r
 }\r
 \r
index bcb02ce..f591006 100644 (file)
@@ -1478,7 +1478,12 @@ public class protocol_anan {
             ICLogger.i("BP15 , 定位周期=" + time + "秒");
             try {
                 Config.setLocationMode(runtime.getContextProxy().context, ICLocation.CUSTOM_MOD8_GPS);
-                Config.setLocationCycle(runtime.getContextProxy().context, Integer.parseInt(time));
+                int timeInt = Integer.parseInt(time);
+                //add k.liang 不知道为啥,不设置定位周期的时候返回的是5,设置之后为300,坑
+                if(timeInt < 15){
+                    timeInt = timeInt * 60;
+                }
+                Config.setLocationCycle(runtime.getContextProxy().context, timeInt);
                 runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(runtime.getContextProxy().context));
                 runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(runtime.getContextProxy().context));
                 //set AlarmCycle  and trigger Location
index 3c47b87..f294bbe 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Oct 22 10:46:09 CST 2021\r
-VERSION_CODE=984\r
+#Fri Oct 22 20:05:07 CST 2021\r
+VERSION_CODE=988\r
index a5707c5..c15156f 100644 (file)
@@ -5,4 +5,4 @@
 # For customization when using a Version Control System, please read the\r
 # header note.\r
 #Fri Oct 15 10:40:33 CST 2021\r
-sdk.dir=E\:\\Android\\Sdk\r
+sdk.dir=D\:\\android\\Android\\sdk\r