diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7eebe094..b165d75c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -89,6 +89,9 @@
+
+
+
@@ -166,9 +169,6 @@
-
-
-
SendCameraCtrl(channel, preset, cmd);
}
+
+
+extern "C" JNIEXPORT void JNICALL
+Java_com_xypower_mpapp_MicroPhotoService_notifyTimeUpdated(
+ JNIEnv* env, jobject pThis, jlong handle) {
+
+ CTerminal* pTerminal = reinterpret_cast(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 350bd739..251da4be 100644
--- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java
+++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java
@@ -135,8 +135,6 @@ public class MicroPhotoService extends Service {
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";
- public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_CHANGED";
-
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";
@@ -298,7 +296,7 @@ public class MicroPhotoService extends Service {
intentFilter.addAction(ACTION_HEARTBEAT_MANUALLY);
intentFilter.addAction(ACTION_GPS_TIMEOUT);
intentFilter.addAction(ACTION_RESTART);
- intentFilter.addAction(ACTION_TIME_CHANGED);
+ intentFilter.addAction(Intent.ACTION_TIME_CHANGED);
getApplicationContext().registerReceiver(mAlarmReceiver, intentFilter, Context.RECEIVER_EXPORTED | Context.RECEIVER_VISIBLE_TO_INSTANT_APPS);
}
{
@@ -662,8 +660,11 @@ public class MicroPhotoService extends Service {
ex.printStackTrace();
}
restartSelfImpl(context, reason);
- } else if (TextUtils.equals(ACTION_TIME_CHANGED, action)) {
-
+ } 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);
}
}
}
@@ -1603,6 +1604,8 @@ cellSignalStrengthGsm.getDbm();
// protected native long[] getNextScheduleItem(long handler);
protected native boolean notifyToTakePhoto(long handler, int channel, int preset, long scheduleTime, String url, int mediaType);
+ 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);