completed anan protocol for location upload trigger.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 27 Apr 2021 03:43:02 +0000 (11:43 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 27 Apr 2021 03:43:02 +0000 (11:43 +0800)
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/ic/protocols/protocol_anan.java

index 217e157..14dd796 100644 (file)
@@ -9,6 +9,7 @@ import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.database.Cursor;
 import android.media.AudioManager;
 import android.net.Uri;
 import android.os.Handler;
@@ -28,7 +29,9 @@ import com.enqualcomm.support.bean.SleepInfo;
 import com.enqualcomm.support.bean.SleepRecord;
 import com.enqualcomm.support.bean.StringMessage;
 import com.enqualcomm.support.bean.heartRateStatus;
+import com.enqualcomm.support.provider.FZDDatabaseHelper;
 import com.enqualcomm.support.provider.FZDMessageProvider;
+import com.enqualcomm.support.provider.FZDSettingsProvider;
 import com.enqualcomm.support.service.AntiMonitorService;
 import com.enqualcomm.support.service.CheckSIM;
 import com.enqualcomm.support.service.Deliver;
@@ -1075,6 +1078,20 @@ public class CoreService extends Service {
                 return Service.START_STICKY;
             } else if (ACTION_LOCATION_ALARM.equals(paramIntent.getAction())) {
                 ICLogger.d("收到定位闹钟...");
+                //如果设置项是关的,那么就return掉,如果设置项开了,直接去设置闹钟
+                Cursor query = runtime.getContextProxy().getResolver().query(Uri.parse(FZDSettingsProvider.SETTINGS),
+                        new String[]{FZDDatabaseHelper.sValue},
+                        FZDDatabaseHelper.sKey + "=?",
+                        new String[]{"BPSW"}, null);
+                if (query != null && query.moveToNext()) {
+                    //1表示打开,0表示关闭
+                    int isOpen = query.getInt(0);
+                    ICLogger.d("isOpen is == > " + isOpen);
+                    query.close();
+                    if (isOpen == 0) {
+                        return Service.START_STICKY;
+                    }
+                }
 //                    if (cmcm_call_eiot_into_powersave_mode() == 1) {
 //                        ICLogger.i("2 into powersave return");
 //                        return Service.START_NOT_STICKY;
index 77d8e04..1675fdf 100644 (file)
@@ -636,6 +636,12 @@ public class protocol_anan {
             String value = split[3];
             //1打开,0关闭 (终端默认为1)
             ICLogger.d("cmd == > " + cmd);
+            if ("1".equals(value)) {
+                ICLogger.d("打开定位开关...按原周期进行定位..上报..");
+                //打开定位闹钟
+                CoreService.getInstance()
+                        .setLocationAlarm(mRuntime.getLocationInstance().getWorkingMod());
+            }
             //设置项进入数据库
             // 不取消定位闹钟,而是在定位闹钟广播的地方去判断
             // 因为用户可能又开启了,所以闹钟还是需要的
@@ -780,7 +786,8 @@ public class protocol_anan {
                 runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(runtime.getContextProxy().context));
                 runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(runtime.getContextProxy().context));
                 //set AlarmCycle  and trigger Location
-                CoreService.getInstance().setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
+                CoreService.getInstance()
+                        .setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
             } catch (Exception e) {
                 ICLogger.e(e.getMessage(), e);
             }