|
|
|
@ -350,12 +350,14 @@ public class MpMasterService extends Service {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
File mpappDb = new File(appPath + "data/App.db");
|
|
|
|
|
long modifiedTimeOfDb = 0;
|
|
|
|
|
if (mpappDb.exists()) {
|
|
|
|
|
modifiedTimeOfDb = mpappDb.lastModified();
|
|
|
|
|
}
|
|
|
|
|
if ((ts - modifiedTimeOfDb) > mTimeOfMpAppAlive) {
|
|
|
|
|
File mpappHb = new File(appPath + "data/alive/hb");
|
|
|
|
|
long modifiedTimeOfHb = getFileModificationTime(appPath + "data/alive/hb");
|
|
|
|
|
long modifiedTimeOfPhoto = getFileModificationTime(appPath + "data/alive/taking");
|
|
|
|
|
long modifiedTimeOfUpload = getFileModificationTime(appPath + "data/alive/upload");
|
|
|
|
|
|
|
|
|
|
if (((ts - modifiedTimeOfHb) > mTimeOfMpAppAlive) ||
|
|
|
|
|
((ts - modifiedTimeOfPhoto) > mTimeOfMpAppAlive * 4) ||
|
|
|
|
|
((ts - modifiedTimeOfUpload) > mTimeOfMpAppAlive * 4)) {
|
|
|
|
|
// greater than 30m
|
|
|
|
|
logger.warning("Start MpAPP as it is NOT running");
|
|
|
|
|
MicroPhotoContext.restartMpApp(context);
|
|
|
|
@ -366,6 +368,16 @@ public class MpMasterService extends Service {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long getFileModificationTime(String path) {
|
|
|
|
|
File file = new File(path);
|
|
|
|
|
long mt = 0;
|
|
|
|
|
if (file.exists()) {
|
|
|
|
|
mt = file.lastModified();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getMpAppVersion() {
|
|
|
|
|
if (TextUtils.isEmpty(mMpAppVersion)) {
|
|
|
|
|
PackageManager packageManager = getPackageManager();
|
|
|
|
|