延迟重启MpAPP

避免打断拍照
MQTTtest
Matthew 9 months ago
parent fd16115e3e
commit fa176e8877

@ -121,6 +121,7 @@ public class MpMasterService extends Service {
private boolean mSeparateNetwork = false;
private long mDelayedRestartMpTime = 60000;
private PendingIntent mPreviousHB = null;
private long mPreviousHeartbeatTime = 0;
@ -366,7 +367,7 @@ public class MpMasterService extends Service {
final String appPath = MicroPhotoContext.buildMpAppDir(context);
final long ts = System.currentTimeMillis();
if (ts - mTimeToStartMpApp < 30000) {
logger.warning("MpAPP is STILL Running");
logger.warning("MpAPP has restarted in 30s");
return;
}
@ -387,7 +388,7 @@ public class MpMasterService extends Service {
MicroPhotoContext.restartMpApp(context);
mTimeToStartMpApp = System.currentTimeMillis();
}
}, 60000);
}, mDelayedRestartMpTime);
}
} catch (Exception ex) {
@ -521,7 +522,7 @@ public class MpMasterService extends Service {
mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 600000);
}
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action);
mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration));
mService.registerHeartbeatTimer();
@ -645,6 +646,7 @@ public class MpMasterService extends Service {
registerHeartbeatTimer(zeroPoint + closestTime * 1000, keepAlive);
}
} else {
// mUsingAbsHbTime: false
if ((mPreviousHeartbeatTime != 0) && (mPreviousHeartbeatTime - currentTimeMs < mHeartbeatDuration * 1000)) {
registerHeartbeatTimer(mPreviousHeartbeatTime + mHeartbeatDuration * 1000, keepAlive);
} else {

Loading…
Cancel
Save