simplejsble 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +5 -1
- package/apple/SimpleBLE.xcframework/ios-arm64/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/libsimpleble.a +0 -0
- package/dependencies/internal/include/simplejni/VM.hpp +9 -0
- package/package.json +1 -1
package/android/CMakeLists.txt
CHANGED
|
@@ -33,6 +33,10 @@ set(BUILD_SHARED_LIBS OFF)
|
|
|
33
33
|
add_subdirectory(${PROJECT_ROOT_DIR}/simpleble ${CMAKE_BINARY_DIR}/simpleble)
|
|
34
34
|
set(BUILD_SHARED_LIBS ON)
|
|
35
35
|
|
|
36
|
+
# Add React Native Android define to simpleble (for JNI_GetCreatedJavaVMs workaround)
|
|
37
|
+
# JNI_GetCreatedJavaVMs is not available in React Native environments
|
|
38
|
+
target_compile_definitions(simpleble PRIVATE __REACT_NATIVE_ANDROID__=1)
|
|
39
|
+
|
|
36
40
|
# Remove nativehelper from SimpleBLE (not available in React Native)
|
|
37
41
|
get_target_property(SIMPLEBLE_LINK_LIBS simpleble INTERFACE_LINK_LIBRARIES)
|
|
38
42
|
if(SIMPLEBLE_LINK_LIBS)
|
|
@@ -74,4 +78,4 @@ set_target_properties(NitroSimplejsble PROPERTIES
|
|
|
74
78
|
)
|
|
75
79
|
|
|
76
80
|
# Add SimpleBLE compile definitions
|
|
77
|
-
target_compile_definitions(NitroSimplejsble PRIVATE FMT_HEADER_ONLY FMT_UNICODE=0)
|
|
81
|
+
target_compile_definitions(NitroSimplejsble PRIVATE FMT_HEADER_ONLY FMT_UNICODE=0 __REACT_NATIVE_ANDROID__=1)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -21,10 +21,19 @@ class VM {
|
|
|
21
21
|
}
|
|
22
22
|
instance._jvm = jvm_override;
|
|
23
23
|
} else if (instance._jvm == nullptr) {
|
|
24
|
+
#ifdef __REACT_NATIVE_ANDROID__
|
|
25
|
+
// On React Native/Expo Android, JNI_GetCreatedJavaVMs is not available.
|
|
26
|
+
// The JVM must be set via set_jvm() from JNI_OnLoad.
|
|
27
|
+
throw std::runtime_error(
|
|
28
|
+
"JavaVM not initialized. Ensure JNI_OnLoad calls "
|
|
29
|
+
"SimpleBLE::Advanced::Android::set_jvm(vm) before any SimpleBLE operations"
|
|
30
|
+
);
|
|
31
|
+
#else
|
|
24
32
|
jsize count;
|
|
25
33
|
if (JNI_GetCreatedJavaVMs(&instance._jvm, 1, &count) != JNI_OK || count == 0) {
|
|
26
34
|
throw std::runtime_error("Failed to retrieve the Java Virtual Machine");
|
|
27
35
|
}
|
|
36
|
+
#endif
|
|
28
37
|
}
|
|
29
38
|
return instance._jvm;
|
|
30
39
|
}
|