From c3c7b977e5616950bfaedaa02008dfc40c6ade18 Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期一, 22 二月 2021 14:55:21 +0800
Subject: [PATCH] 升级用到配置的省市ID
---
lib/src/main/cpp/native-lib.cpp | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/lib/src/main/cpp/native-lib.cpp b/lib/src/main/cpp/native-lib.cpp
index 6284991..7c14d93 100644
--- a/lib/src/main/cpp/native-lib.cpp
+++ b/lib/src/main/cpp/native-lib.cpp
@@ -288,6 +288,37 @@
}
}
+void GetUpgrade(int province, int city)
+{
+ JNIEnv *env;
+ bool ready_in_java_env = false;
+
+ if (sg_jvm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) {
+ // Attach涓荤嚎绋�
+ if (sg_jvm->AttachCurrentThread(&env, NULL) != JNI_OK) {
+ LOGE("%s: AttachCurrentThread() failed", __FUNCTION__);
+ return;
+ }
+ } else {
+ ready_in_java_env = true;
+ }
+
+ jclass cls = env->GetObjectClass(sg_obj);
+ jmethodID fun = env->GetMethodID(cls, "GetUpgrade", "(II)V");
+
+ env->CallVoidMethod(sg_obj, fun, province, city);
+
+ env->DeleteLocalRef(cls);
+
+ if (!ready_in_java_env) {
+ //Detach涓荤嚎绋�
+ if (sg_jvm->DetachCurrentThread() != JNI_OK) {
+ LOGE("%s: DetachCurrentThread() failed", __FUNCTION__);
+ }
+ }
+}
+
+
void SendToBluetooth(const uint8_t *data, int length)
{
JNIEnv *env;
--
Gitblit v1.8.0