diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index b9b1e0ef..877533d5 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -412,6 +412,21 @@ public class MpMasterService extends Service { th.start(); } + private boolean isMpAppAlive(Context context) { + if (Build.TIME < 1744905600000L) { + // 2025-04-18 old firmware + // Check Log file time + File file = new File(MicroPhotoContext.buildMpAppDir(context) + "logs/log.txt"); + if (file.exists()) { + return ((System.currentTimeMillis() - file.lastModified()) < 1800000); + } else { + return false; + } + } + + return MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE); + } + private void detectMpAppAliveImpl() { try { final Context context = getApplicationContext(); @@ -425,7 +440,7 @@ public class MpMasterService extends Service { } boolean isMpAppRunning = false; for (int idx = 0; idx < detectionCnt; idx++) { - isMpAppRunning = MicroPhotoContext.isAppAlive(context, MicroPhotoContext.PACKAGE_NAME_MPAPP, MicroPhotoContext.SERVICE_NAME_MPSERVICE); + isMpAppRunning = isMpAppAlive(context); if (isMpAppRunning) { break; }