From cc91a658a0e80b258620130d728dcc92a6cd67d6 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 12 Jun 2024 11:06:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E8=B7=B3=E6=97=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E6=A3=80=E6=B5=8B=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/MicroPhoto.cpp | 15 +++++++++++++++ .../java/com/xypower/mpapp/MicroPhotoService.java | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/src/main/cpp/MicroPhoto.cpp b/app/src/main/cpp/MicroPhoto.cpp index ac458a7c..e17bca9e 100644 --- a/app/src/main/cpp/MicroPhoto.cpp +++ b/app/src/main/cpp/MicroPhoto.cpp @@ -682,6 +682,21 @@ Java_com_xypower_mpapp_MicroPhotoService_reloadConfigs( pTerminal->LoadAppConfigs(); } + +extern "C" JNIEXPORT void JNICALL +Java_com_xypower_mpapp_MicroPhotoService_infoLog( + JNIEnv* env, jclass cls, jstring msg) { + + if (env->GetStringUTFLength(msg) <=0) + { + return JNI_FALSE; + } + + const char *msgStr = env->GetStringUTFChars(msg, 0); + XYLOG(XYLOG_SEVERITY_INFO, msgStr); + env->ReleaseStringUTFChars(outputPath, outputPathStr); +} + extern "C" JNIEXPORT void JNICALL Java_com_xypower_mpapp_MicroPhotoService_setOtgState( JNIEnv* env, diff --git a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java index bc8f089a..2da86b1b 100644 --- a/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java +++ b/app/src/main/java/com/xypower/mpapp/MicroPhotoService.java @@ -306,6 +306,17 @@ public class MicroPhotoService extends Service { mService.registerHeartbeatTimer(); + try { + ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); + if (connectivityManager != null) { + if (!connectivityManager.isDefaultNetworkActive()) { + infoLog("DefaultNetwork is NOT Active"); + } + } + } catch (Exception ex) { + + } + } else if (TextUtils.equals(ACTION_TAKE_PHOTO, action)) { long ts = intent.getLongExtra(EXTRA_PARAM_TIME, 0); int cnt = intent.getIntExtra(EXTRA_PARAM_SCHEDULES, 0); @@ -1137,6 +1148,7 @@ cellSignalStrengthGsm.getDbm(); protected native void updatePosition(long handler, double lon, double lat, double radius, long ts); protected native boolean uninit(long handler); protected native void recordingFinished(long handler, boolean result, String path, long videoId); + public static native void infoLog(String log); public static native void setOtgState(boolean enabled); public static native void setCam3V3Enable(boolean enabled); public static native String getSerialNumber(); @@ -1151,6 +1163,7 @@ cellSignalStrengthGsm.getDbm(); public static native boolean exportPrivateFile(int index, String outputPath); + ////////////////////////GPS//////////////////// // private static final String GPS_LOCATION_NAME = android.location.LocationManager.GPS_PROVIDER; private LocationManager mLocationManager;