diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0f614729..08ac2a18 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -86,6 +86,10 @@
+
+
+
+
+ android:exported="true" >
+
(handle);
+ if (pTerminal == NULL)
+ {
+ return;
+ }
+
+ std::thread t([pTerminal]()
+ {
+ pTerminal->OnTimeUpdated();
+ });
+ t.detach();
+}
diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java
index 0faea91d..f87f0370 100644
--- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java
+++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java
@@ -119,6 +119,7 @@ public class MicroPhotoService extends Service {
private static final String ACTION_HEARTBEAT_MANUALLY = "com.xypower.mpapp.ACT_HB_M";
private static final String ACTION_UPDATE_CONFIGS = "com.xypower.mpapp.ACT_UPD_CFG";
public static final String ACTION_VIDEO_FINISHED = "com.xypower.mpapp.ACT_V_FINISHED";
+
private static final String EXTRA_PARAM_CHANNEL = "Channel";
private static final String EXTRA_PARAM_PRESET = "Preset";
private static final String EXTRA_PARAM_PHOTO_OR_VIDEO = "PhotoOrVideo";
@@ -272,11 +273,7 @@ public class MicroPhotoService extends Service {
intentFilter.addAction(ACTION_HEARTBEAT_MANUALLY);
intentFilter.addAction(ACTION_GPS_TIMEOUT);
intentFilter.addAction(ACTION_RESTART);
- // intentFilter.addAction(ACTION_HEARTBEAT_MANUALLY);
- // intentFilter.addAction(ACTION_MSG_BROADCAST);
- // intentFilter.addAction(ACTION_VIDEO_FINISHED);
- // intentFilter.addAction(ACTION_STOP);
- // intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
+ intentFilter.addAction(Intent.ACTION_TIME_CHANGED);
getApplicationContext().registerReceiver(mAlarmReceiver, intentFilter, Context.RECEIVER_EXPORTED | Context.RECEIVER_VISIBLE_TO_INSTANT_APPS);
// IntentFilter intentFilter2 = new IntentFilter(ACTION_MSG_BROADCAST);
@@ -622,7 +619,12 @@ public class MicroPhotoService extends Service {
} catch (Exception ex) {
ex.printStackTrace();
}
- MicroPhotoService.restartApp(context.getApplicationContext(), MicroPhotoContext.PACKAGE_NAME_MPAPP, "Restart Cmd");
+ restartSelfImpl(context, reason);
+ } else if (TextUtils.equals(Intent.ACTION_TIME_CHANGED, action)) {
+ mService.notifyTimeUpdated(mService.mNativeHandle);
+ Date date = new Date();
+ long startTime = (date.getTime() + 999) / 1000;
+ mService.updateCaptureSchedule(startTime);
}
}
}
@@ -1496,6 +1498,8 @@ cellSignalStrengthGsm.getDbm();
// protected native long[] getNextScheduleItem(long handler);
protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, boolean photoOrVideo);
+ protected native void notifyTimeUpdated(long handler);
+
protected native boolean sendHeartbeat(long handler, int signalLevel);
protected native boolean reloadConfigs(long handler);
protected native void updatePosition(long handler, double lon, double lat, double radius, long ts);