diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index dc90962b..52be2754 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -101,7 +101,7 @@ public class MpMasterService extends Service { private String mCmdid = ""; private NotificationManager mNotificationManager; private int mQuickHeartbeatDuration = 60; // Unit: second - private int mHeartbeatDuration = 600; // 10m = 10 * 60s + private int mHeartbeatDuration = 600; // Unit: second 10m = 10 * 60s private long mTimeForKeepingLogs = 86400000 * 15; // 15 days @@ -471,6 +471,9 @@ public class MpMasterService extends Service { } MicroPhotoContext.AppConfig appConfig = MicroPhotoContext.getMpAppConfig(getApplicationContext()); + if (appConfig.heartbeat > 0) { + mMpHeartbeatDuration = appConfig.heartbeat; + } logger.warning("Start Mntn report: " + masterUrl + " MntnMode=" + (mMntnMode ? "1" : "0") + " QuickHB=" + (mQuickHbMode ? "1" : "0")); @@ -631,7 +634,7 @@ public class MpMasterService extends Service { if (zeroPoint + closestTime * 1000 > currentTimeMs + mMpHeartbeatDuration * 60000) { keepAlive = true; - registerHeartbeatTimer(currentTimeMs + timeout * 1000, keepAlive); + registerHeartbeatTimer(currentTimeMs + mMpHeartbeatDuration * 60000, keepAlive); } else { registerHeartbeatTimer(zeroPoint + closestTime * 1000, keepAlive); } @@ -1001,7 +1004,6 @@ public class MpMasterService extends Service { Method method1 = telephonyManager.getClass().getDeclaredMethod("setDataEnabled", boolean.class); method1.invoke(telephonyManager, true); } catch (Exception e) { - // Log.e(TAG, "wjz debug setDefaultDataSubId: error is " + e.getMessage()); e.printStackTrace(); } } @@ -1011,8 +1013,8 @@ public class MpMasterService extends Service { try { Method method = subscriptionManager.getClass().getDeclaredMethod("getDefaultDataSubscriptionId"); return (int) method.invoke(subscriptionManager); - } catch (Exception e) { - Log.e(TAG, "wjz debug getDefaultDataSubId: error is " + e.getMessage()); + } catch (Exception ex) { + ex.printStackTrace(); } return 0; }