import android.telephony.TelephonyManager;\r
\r
import java.util.Random;\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
+import java.util.concurrent.ScheduledThreadPoolExecutor;\r
import java.util.concurrent.TimeUnit;\r
\r
import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;\r
stringBuilder.append(paramInt2);\r
ICLogger.i(stringBuilder.toString());\r
// if (ACTION_ALARM.equals(paramIntent.getAction())) {\r
- if (ACTION_LOCATION_ALARM.equals(paramIntent.getAction())){\r
+ if (ACTION_LOCATION_ALARM.equals(paramIntent.getAction())) {\r
\r
\r
// if (cmcm_call_eiot_into_powersave_mode() == 1) {\r
// alarmCycle = Config.getAlarmCycle(this);\r
// }\r
AlarmWakeUp.setAlarmWakeUpTime();\r
- boolean screenon = ((PowerManager)getSystemService(POWER_SERVICE)).isScreenOn();\r
+ boolean screenon = ((PowerManager) getSystemService(POWER_SERVICE)).isScreenOn();\r
if (!screenon) {\r
SimSignalUtil.send_at_to_update_lbs(this.runtime);\r
}\r
if (Config.LOG_TOFILE) ICLogger.logToFile("alarmCycle", stringBuilder1.toString());\r
// this.locationClient.triggerLocationProcess();\r
\r
- } else {\r
+ } else if (Constants.SLEEP_ALARM.equals(paramIntent.getAction())) {\r
StringBuilder stringBuilder1;\r
- if (Constants.SLEEP_ALARM.equals(paramIntent.getAction())) {\r
- ICLogger.i("SLEEP_ALARM");\r
- is_allowed_in_sleep_mode = 1;\r
- if (Config.LOG_TOFILE) ICLogger.logToFile("alarmCycle", "SLEEP_ALARM alarmCycle");\r
- setSleepAlarm();\r
- boolean bool = ((PowerManager)getSystemService(POWER_SERVICE)).isScreenOn();\r
- stringBuilder1 = new StringBuilder();\r
- stringBuilder1.append("ifOpen = ");\r
- stringBuilder1.append(bool);\r
- ICLogger.i(stringBuilder1.toString());\r
- if (!bool) {\r
- is_in_sleep_mode = true;\r
- if (this.mKeepAlive != null)\r
- this.mKeepAlive.setSleepMode(true);\r
+ ICLogger.i("SLEEP_ALARM");\r
+ is_allowed_in_sleep_mode = 1;\r
+ if (Config.LOG_TOFILE) ICLogger.logToFile("alarmCycle", "SLEEP_ALARM alarmCycle");\r
+ setSleepAlarm();\r
+ boolean bool = ((PowerManager) getSystemService(POWER_SERVICE)).isScreenOn();\r
+ stringBuilder1 = new StringBuilder();\r
+ stringBuilder1.append("ifOpen = ");\r
+ stringBuilder1.append(bool);\r
+ ICLogger.i(stringBuilder1.toString());\r
+ if (!bool) {\r
+ is_in_sleep_mode = true;\r
+ if (this.mKeepAlive != null)\r
+ this.mKeepAlive.setSleepMode(true);\r
// this.connection.close();\r
- return Service.START_STICKY;\r
- }\r
- } else {\r
- if (Constants.WAKE_ALARM.equals(paramIntent.getAction())) {\r
- if (is_in_sleep_mode) {\r
- is_in_sleep_mode = false;\r
- if (Config.LOG_TOFILE) ICLogger.logToFile("alarmCycle", "WAKE_ALARM alarmCycle");\r
- if (this.mKeepAlive != null)\r
- this.mKeepAlive.setSleepMode(false);\r
- wakeUpFromSleep();\r
- }\r
- is_allowed_in_sleep_mode = 1;\r
- setWakeAlarm();\r
- return Service.START_STICKY;\r
- }else if (HEART_ALARM.equals(paramIntent.getAction())) {\r
- if (this.mKeepAlive != null) {\r
-\r
- if (connection.isServerConnected()&& runtime.isServerProtocolConnected()) {\r
- this.mKeepAlive.onHeartAlarm(this.connection, this.runtime);\r
- }else{\r
- ICLogger.i("check 发送心跳包时,如果发现服务器没有响应,或者socket连接,则重新尝试连接服务器!");\r
- connection.disconnectServer();\r
- this.startConnectionRetryTimer();\r
- }\r
- setHeartAlarm();\r
- if (Config.LOG_TOFILE) ICLogger.logToFile("alarmCycle", "HEART_ALARM alarmCycle " );\r
- return Service.START_STICKY;\r
- }\r
- } else if (STEP_COUNT_ALARM_ACTION.equals(paramIntent.getAction())) {\r
- ICLogger.i("Reset Count At 00:00 ");\r
- //update stepCount and broadcast before reset\r
- this.locationClient.updateStepCount();\r
- runtime.getContextProxy().brodcastResetStepCount(runtime.getTotalStepCount());\r
- resetStepCount();\r
- setCleanStepCountAlarm();\r
-\r
- return Service.START_STICKY;\r
- }else {\r
- if (ACTION_HEATR_RATE_START.equals(paramIntent.getAction())) {\r
-\r
- //此处消息从timer来\r
- setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
-\r
- }else if(ACTION_SEND_EMEGENCY_LOCATION_STOP.equals(paramIntent.getAction())){\r
- //stop Emegency location Stop\r
- Config.loadModCycleSettings(runtime); //回复之前的 工作模式即可\r
- setLocationAlarm(runtime.getLocationInstance().getWorkingMod());//同时重置alarm并触发定位\r
- }\r
- this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime);\r
-// }\r
+ return Service.START_STICKY;\r
+ }\r
+ } else if (Constants.WAKE_ALARM.equals(paramIntent.getAction())) {\r
+ if (is_in_sleep_mode) {\r
+ is_in_sleep_mode = false;\r
+ if (Config.LOG_TOFILE)\r
+ ICLogger.logToFile("alarmCycle", "WAKE_ALARM alarmCycle");\r
+ if (this.mKeepAlive != null)\r
+ this.mKeepAlive.setSleepMode(false);\r
+ wakeUpFromSleep();\r
+ }\r
+ is_allowed_in_sleep_mode = 1;\r
+ setWakeAlarm();\r
+ return Service.START_STICKY;\r
+ } else if (HEART_ALARM.equals(paramIntent.getAction())) {\r
+ if (this.mKeepAlive != null) {\r
+\r
+ if (connection.isServerConnected() && runtime.isServerProtocolConnected()) {\r
+ this.mKeepAlive.onHeartAlarm(this.connection, this.runtime);\r
+ } else {\r
+ ICLogger.i("check 发送心跳包时,如果发现服务器没有响应,或者socket连接,则重新尝试连接服务器!");\r
+ connection.disconnectServer();\r
+ this.startConnectionRetryTimer();\r
}\r
+ setHeartAlarm();\r
+ if (Config.LOG_TOFILE)\r
+ ICLogger.logToFile("alarmCycle", "HEART_ALARM alarmCycle ");\r
+ return Service.START_STICKY;\r
}\r
+ } else if (STEP_COUNT_ALARM_ACTION.equals(paramIntent.getAction())) {\r
+ ICLogger.i("Reset Count At 00:00 ");\r
+ //update stepCount and broadcast before reset\r
+ this.locationClient.updateStepCount();\r
+ runtime.getContextProxy().brodcastResetStepCount(runtime.getTotalStepCount());\r
+ resetStepCount();\r
+ setCleanStepCountAlarm();\r
+ return Service.START_STICKY;\r
+ } else if (ACTION_HEATR_RATE_START.equals(paramIntent.getAction())) {\r
+\r
+ //此处消息从timer来\r
+ setHeartRateDetectAlarm(runtime.getPpgTestCycle());\r
+\r
+\r
+ } else if (ACTION_SEND_EMEGENCY_LOCATION_STOP.equals(paramIntent.getAction())) {\r
+ //stop Emegency location Stop\r
+ Config.loadModCycleSettings(runtime); //回复之前的 工作模式即可\r
+ setLocationAlarm(runtime.getLocationInstance().getWorkingMod());//同时重置alarm并触发定位\r
+\r
}\r
+\r
+\r
+ this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime);\r
+\r
}\r
return Service.START_NOT_STICKY;\r
}\r
\r
private static final String TAG = "ICSrv." + CoreService.class.getSimpleName();\r
\r
- private Timer mTimer_retry_connect=null;\r
+ private ScheduledThreadPoolExecutor mTimer_retry_connect=null;\r
\r
private static int retry_connect_count=0; //当前重试次数\r
private static int retry_connect_max_times=6; //最大重试次数 6次 , 即只重试2分钟,下一次重试将在下一个心跳包时进行。\r
// if (SimSignalUtil.checkNet(runtime.getContextProxy().context) ) {\r
stopConnectionRetryTimer();\r
if (mTimer_retry_connect == null) {\r
- mTimer_retry_connect = new Timer();\r
+ mTimer_retry_connect = new ScheduledThreadPoolExecutor(2);\r
}\r
//如果开始进行连接重\r
// {\r
retry_connect_count=0;\r
KeepAlive.isConnected = false;\r
if (mTimer_retry_connect != null) {\r
- mTimer_retry_connect.schedule(new TimerTask() {\r
+ mTimer_retry_connect.scheduleAtFixedRate(new Runnable() {\r
@Override\r
public void run() {\r
ReConnectToServer();\r
}\r
- }, 5000, 20000); //每次都是断网才需要重连,delay 5秒重连,并且每20秒重试一次\r
+ }, 5000, 20000, TimeUnit.MILLISECONDS); //每次都是断网才需要重连,delay 5秒重连,并且每20秒重试一次\r
}\r
// }\r
}\r
\r
public void stopConnectionRetryTimer(){\r
if (mTimer_retry_connect !=null){\r
- mTimer_retry_connect.cancel();\r
+ mTimer_retry_connect.shutdown();\r
mTimer_retry_connect.purge();\r
mTimer_retry_connect = null;\r
}\r
import android.graphics.Color;\r
import android.graphics.Rect;\r
import android.os.Bundle;\r
-import android.os.Handler;\r
-import android.os.Message;\r
import android.os.PowerManager;\r
import android.support.v7.app.AppCompatActivity;\r
import android.support.v7.widget.LinearLayoutManager;\r
\r
import java.util.ArrayList;\r
import java.util.List;\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
-\r
public class GPSActivity extends AppCompatActivity implements location_callback {\r
\r
private RecyclerView mRv;\r
private TextView mHoop;\r
private TextView mSearchCount;\r
private boolean showmessage=false;\r
- private Timer timer;\r
final LocationSnrAdapter adapter = new LocationSnrAdapter(testSnrEntriyDate(null));\r
-//\r
-// Handler handler=new Handler(new Handler.Callback() {\r
-// @Override\r
-// public boolean handleMessage(Message message) {\r
-//\r
-//\r
-// StringBuilder sb=new StringBuilder();\r
-// try {\r
-//\r
-// if (showmessage) {\r
-// ICLocation location=CoreService.getInstance().runtime.getLocationInstance();\r
-// List<ICLocation.GpsSatellitePriv> gpslist =location.getNumSatelliteList();\r
-// adapter.updateLocationValue(testSnrEntriyDate(gpslist));\r
-// String fixed=(location.getLocationStat()==ICLocation.LOCATION_STAT.LOCATION_FIXED)?\r
-// "Fixed":(location.getLocationStat()==ICLocation.LOCATION_STAT.LOCATION_OPEN)?\r
-// "Opened":(location.getLocationStat()==ICLocation.LOCATION_STAT.LOCATION_GPS_TIEMOUT)?\r
-// "Timeout":"Closed";\r
-// String satlites=new StringBuilder().append(location.getLocation().used_gps_numbs).append("/").append(gpslist!=null?location.getNumSatelliteList().size():0).toString();\r
-// String locationTime=location.getLocationTime();\r
-// mFix.setText(fixed);\r
-// mStar.setText(satlites);\r
-// mHoop.setText(String.valueOf(location.getLocation().hdop));\r
-// }\r
-//\r
-// }catch(Exception e){\r
-// e.printStackTrace();\r
-// }\r
-//\r
-//\r
-// return false;\r
-// }\r
-// });\r
+\r
@Override\r
protected void onCreate(Bundle savedInstanceState) {\r
super.onCreate(savedInstanceState);\r
@Override\r
protected void onResume() {\r
super.onResume();\r
-// TimerTask tmt=new TimerTask() {\r
-// @Override\r
-// public void run() {\r
-// handler.sendEmptyMessage(0);\r
-// }\r
-// };\r
-// timer=new Timer();\r
-// timer.schedule(tmt,0,2000);\r
-// showmessage=true;\r
NMEAListener.set_callback(this);\r
if (screenOnWakelock==null)\r
screenOnWakelock = WakeLockUtil.getScreenOnWakeLock(this,GPSActivity.class.getSimpleName());\r
@Override\r
protected void onPause() {\r
super.onPause();\r
-// if (timer!=null) {\r
-// timer.cancel();\r
-// timer.purge();\r
-// timer = null;\r
-// }\r
showmessage=false;\r
if(screenOnWakelock!=null) {\r
if (screenOnWakelock.isHeld()) {\r
import com.enqualcomm.support.bean.Runtime;\r
import com.enqualcomm.support.utils.TimeUtil;\r
\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
import java.util.concurrent.ExecutorService;\r
import java.util.concurrent.Executors;\r
import java.util.concurrent.LinkedBlockingDeque;\r
+import java.util.concurrent.ScheduledThreadPoolExecutor;\r
import java.util.concurrent.TimeUnit;\r
import java.util.concurrent.locks.Condition;\r
import java.util.concurrent.locks.ReentrantLock;\r
\r
private LBSHelper mLbsHelper;\r
\r
- private Timer mTimer=null;\r
+ private ScheduledThreadPoolExecutor mTimer=null;\r
\r
private int mPedometer2;\r
\r
timeout=false;\r
startCheckTime= System.currentTimeMillis();\r
//延时2秒执行发送“读取定位”消息\r
- if (mTimer==null) mTimer=new Timer();\r
- mTimer.schedule(new MyTimerTask(), 1000L,1000L);\r
+ if (mTimer==null) mTimer=new ScheduledThreadPoolExecutor(2);\r
+ mTimer.scheduleAtFixedRate(new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ mhandler.sendEmptyMessage(msgWhat_WaitAndSendLocation);\r
+ }\r
+ }, 1000L, 1000L,TimeUnit.MILLISECONDS);\r
// AlarmManager alarmManager=(AlarmManager)runtime.getContextProxy().context.getSystemService(Context.ALARM_SERVICE);\r
// AlarmHelper.setAlarm(alarmManager,0,1,);\r
}\r
- class MyTimerTask extends TimerTask {\r
- public void run() {\r
- //发送读取计步消息\r
- mhandler.sendEmptyMessage(msgWhat_WaitAndSendLocation);\r
- }\r
- };\r
\r
\r
\r
if ((startCheckTime!=0L)&& (timeCost> 50*1000L)){\r
//有时timer计数不准,则根据实际时间计算\r
ICLogger.i("waitAndSendLocation "+timeCost+"> 50000ms timeout");\r
- timeout=true;\r
+ //timeout=true;\r
}\r
\r
// lbs only +timeout, lbs+wifi+gpsNosignal, libs+ , lbs+gps+wifi, Timeout can override wifi and gps\r
if ((startCheckTime!=0L)&& (timeCost> 20*1000L)){\r
//有时timer计数不准,则根据实际时间计算\r
ICLogger.i("waitAndSendLocation "+timeCost+"> 20000ms timeout");\r
- timeout=true;\r
+ // timeout=true;\r
}\r
\r
if ((lbs_ok && timeout==true) ||(lbs_ok && wifi_ok )){\r
public void stopCheckLocationResult(){\r
ICLogger.i("stopCheckLocationResult!");\r
if (mTimer!=null){\r
- mTimer.cancel();\r
+ mTimer.shutdown();\r
+ mTimer.purge();\r
mTimer=null;\r
}\r
isLocating = false;\r
import com.enqualcomm.support.CoreService;
import com.enqualcomm.support.utils.ICLogger;
-import java.util.Timer;
-import java.util.TimerTask;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import rx.Observable;
TextView tv;
private boolean showmessage=false;
- private Timer timer;
+ private ScheduledThreadPoolExecutor timer;
Handler handler=new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message message) {
@Override
protected void onResume() {
super.onResume();
- TimerTask tmt=new TimerTask() {
+ timer=new ScheduledThreadPoolExecutor(2);
+ timer.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
handler.sendEmptyMessage(0);
}
- };
- timer=new Timer();
- timer.schedule(tmt,0,2000);
+ }, 0, 2000,TimeUnit.MILLISECONDS);
showmessage=true;
}
protected void onPause() {
super.onPause();
if (timer!=null) {
- timer.cancel();
+ timer.shutdown();
timer.purge();
timer = null;
}
import com.enqualcomm.support.utils.SimSignalUtil;\r
import com.enqualcomm.support.utils.TimeUtil;\r
\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
+import java.util.concurrent.ScheduledThreadPoolExecutor;\r
+import java.util.concurrent.TimeUnit;\r
\r
import static com.enqualcomm.support.Constants.ACTION_BROADCAST_PPG;\r
import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;\r
\r
private Runtime runtime;\r
private NettyConnection connection;\r
- private TimerTaskPPG timerTaskPPG;\r
\r
- private Timer timerPPG;\r
+ private ScheduledThreadPoolExecutor timerPPG=null;\r
private static Handler mHandler=null;\r
\r
\r
runtime.getContextProxy().context.unregisterReceiver(PPGStartReceiver);\r
}\r
\r
- public class TimerTaskPPG extends TimerTask{\r
- @Override\r
- public void run() {\r
- doPPGtest();\r
- }\r
- };\r
-\r
int PPG;\r
int BPH;\r
int BPL;\r
isTimerStarted=true;\r
ICJniUtils.enablePPG();\r
getPPGWakeLock();\r
- timerTaskPPG = new TimerTaskPPG();\r
- timerPPG = new Timer();\r
- timerPPG.scheduleAtFixedRate(timerTaskPPG,0, 1000); //1 秒更新一次数据\r
+\r
+ timerPPG = new ScheduledThreadPoolExecutor(2);\r
+ timerPPG.scheduleAtFixedRate(new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ doPPGtest();\r
+ }\r
+ }, 0, 1000, TimeUnit.MILLISECONDS); //1 秒更新一次数据\r
\r
}\r
}\r
public void stopPPG(){\r
if( isTimerStarted )\r
{\r
- timerPPG.cancel();\r
+ timerPPG.shutdown();\r
+ timerPPG.purge();\r
isTimerStarted=false;\r
}\r
ICJniUtils.disablePPG();\r
import com.enqualcomm.support.bean.Runtime;\r
import com.enqualcomm.support.utils.SimSignalUtil;\r
\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
+import java.util.concurrent.ScheduledThreadPoolExecutor;\r
import java.util.concurrent.TimeUnit;\r
\r
import rx.Observable;\r
import rx.Subscription;\r
import rx.functions.Action1;\r
\r
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;\r
-//import static com.eiot.watch_lib.LauncherCtrl.STATUS_BAR_STATE_SERVER_CONNECTED_OFF;\r
-//import static com.eiot.watch_lib.LauncherCtrl.STATUS_BAR_STATE_SERVER_CONNECTED_ON;\r
-\r
public class KeepAlive extends AbstractConnectionService {\r
private static final long HEARTBEAT_TIMEOUT = 660000L;\r
private static String TAG = KeepAlive.class.getSimpleName();\r
public static boolean isConnected = false;\r
\r
private static boolean isInSleepMode = false;\r
- \r
- private static int mFlag = 30;\r
- \r
+\r
Connection connection;\r
\r
- private int currentReConnectInterval = 11;\r
- \r
- private boolean firstReConnected = true;\r
- \r
- private long idleTimeMillis;\r
- \r
- private int isFirstAsjust;\r
- \r
- private int lastReConnectInterval = -1;\r
- \r
- private int lastReConnectionNumber = -1;\r
- \r
Context mContext;\r
\r
NetworkObservable mNetworkObservable = new NetworkObservable();\r
private Subscription mSubscription;\r
\r
private int reConnectionNumber;\r
- \r
- private int reCycleTimes;\r
- \r
- private int timeout = 660;\r
- \r
- private int totalAdjustTimes;\r
- \r
- private int whichTimeAdjust;\r
\r
//服务器收到AP03 会返回BP03,如果PB03 规定时间没收到,则认为发送心跳失败,需要重发,\r
private boolean is_heartBeat_send_success=false;\r
//每次retry发送心跳的间隔为20秒\r
private int heartBeatRetryTimeout=20;\r
//监测 心跳服务器响应的timer\r
- private Timer mTimer_check_server_response=null;\r
-\r
+ private ScheduledThreadPoolExecutor scheduled = null;\r
+ private Runnable CheckSrvResponseTimerTask=new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ checkSrvResponse();\r
+ }\r
+ };\r
\r
public void startResponseCheckTimer(){\r
//联网再重试连接服务器\r
if (SimSignalUtil.checkNet(mRuntime.getContextProxy().context) ) {\r
stopResponseCheckTimer();\r
- if (mTimer_check_server_response == null) {\r
- mTimer_check_server_response = new Timer();\r
+ if (scheduled == null) {\r
+ scheduled = new ScheduledThreadPoolExecutor(2);\r
}\r
-\r
//开始检测重新计数\r
hearBeatResendCount=0;\r
//如果开始进行连接重\r
// {\r
// 试,证明网络断开的,那么KeepAlive也需要重连(心跳包)\r
-\r
- if (mTimer_check_server_response != null) {\r
- mTimer_check_server_response.schedule(new TimerTask() {\r
- @Override\r
- public void run() {\r
- checkSrvResponse();\r
- }\r
- }, heartBeatRetryTimeout*1000, heartBeatRetryTimeout*1000); //delay 3秒先检查一次,然后每5秒重试一次\r
+ if (scheduled != null) {\r
+ scheduled.scheduleAtFixedRate(CheckSrvResponseTimerTask , heartBeatRetryTimeout*1000, heartBeatRetryTimeout*1000,TimeUnit.MILLISECONDS); //delay 3秒先检查一次,然后每5秒重试一次\r
}\r
}\r
}\r
}\r
\r
public void stopResponseCheckTimer(){\r
- if (mTimer_check_server_response !=null){\r
- mTimer_check_server_response.cancel();\r
- mTimer_check_server_response = null;\r
+ if (scheduled !=null){\r
+ scheduled.shutdown();\r
+ scheduled.purge();\r
+ scheduled = null;\r
}\r
}\r
\r
\r
ICLogger.i("onAlarmClock");\r
\r
- long l = SystemClock.elapsedRealtime();\r
-\r
-// //如果 没有连接成功 或者 时间超过了11分钟 ,则进行重新连接服务\r
-// if (!isConnected || l - this.idleTimeMillis > 660000L) {\r
-// StringBuilder stringBuilder = new StringBuilder();\r
-// stringBuilder.append("重连");\r
-// stringBuilder.append(isConnected);\r
-// ICLogger.i(stringBuilder.toString());\r
-// if (!isConnected && this.firstReConnected) {\r
-// this.reConnectionNumber++;\r
-// this.firstReConnected = false;\r
-// }\r
-//\r
-// CoreService.getInstance().ReConnectToServer();\r
-// }\r
}\r
\r
public void onAttach(final Connection connection, final Runtime runtime) {\r
\r
\r
isConnected = true;\r
- this.firstReConnected = true;\r
- this.idleTimeMillis = SystemClock.elapsedRealtime();\r
+// this.firstReConnected = true;\r
+// this.idleTimeMillis = SystemClock.elapsedRealtime();\r
\r
return false;\r
}\r
}\r
\r
public boolean onReceive(StringMessage paramStringMessage, Connection paramConnection, Runtime paramRuntime) {\r
- this.idleTimeMillis = SystemClock.elapsedRealtime();\r
+// this.idleTimeMillis = SystemClock.elapsedRealtime();\r
if ("heart".equals(paramStringMessage.cmd())) {\r
AlarmWakeUp.isNeedWakeUpAlarm(paramRuntime);\r
return true;\r
Intent intent = new Intent(context, com.enqualcomm.support.CoreService.class);\r
intent.setAction(paramString);\r
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);\r
+ alarmManager.cancel(pendingIntent);\r
long currentMS = System.currentTimeMillis();\r
Calendar calendar = Calendar.getInstance();\r
calendar.set(Calendar.HOUR_OF_DAY, hour);\r
long targetMS = targetMStmp;\r
if (targetMStmp < currentMS)\r
targetMS = targetMStmp + ONE_DAY;\r
- alarmManager.cancel(pendingIntent);\r
alarmManager.setExact(AlarmManager.RTC_WAKEUP, targetMS, pendingIntent);\r
}\r
\r
Intent intent = new Intent();\r
intent.putExtra(PED_TOTAL_KEY, StepCount);\r
intent.setAction(PED_FINISH_ACTION);\r
+ ICLogger.i("send broadcast action "+PED_FINISH_ACTION+", key "+PED_TOTAL_KEY+" value "+StepCount);\r
this.context.sendBroadcast(intent);\r
}\r
public void sendBrodcast(String action,Intent intent){\r
intent.putExtra("command", "AT+SFUN=2"); //重新初始化sim卡\r
intent.putExtra("arg2", "");\r
( runtime.getContextProxy()).context.sendBroadcast(intent);\r
- ICLogger.i("send_at_to_update_lbs ");\r
+ ICLogger.i("send_at_to_reset_simcard ");\r
}\r
\r
public static void send_at_to_update_lbs(Runtime runtime) {\r