simplejsble 0.0.9 → 0.0.14
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.
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
#include <jni.h>
|
|
2
2
|
#include "NitroSimplejsbleOnLoad.hpp"
|
|
3
|
+
#include <simpleble/Advanced.h>
|
|
3
4
|
|
|
4
5
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
6
|
+
SimpleBLE::Advanced::Android::set_jvm(vm);
|
|
7
|
+
|
|
5
8
|
return margelo::nitro::simplejsble::initialize(vm);
|
|
6
9
|
}
|
|
10
|
+
|
|
11
|
+
|
|
@@ -21,10 +21,16 @@ class VM {
|
|
|
21
21
|
}
|
|
22
22
|
instance._jvm = jvm_override;
|
|
23
23
|
} else if (instance._jvm == nullptr) {
|
|
24
|
+
#ifdef __ANDROID__
|
|
25
|
+
// On Android (React Native/Expo), JNI_GetCreatedJavaVMs is not available at runtime.
|
|
26
|
+
// The JVM must be set explicitly via set_jvm() in JNI_OnLoad.
|
|
27
|
+
throw std::runtime_error("JavaVM not set. Call set_jvm() in JNI_OnLoad first.");
|
|
28
|
+
#else
|
|
24
29
|
jsize count;
|
|
25
30
|
if (JNI_GetCreatedJavaVMs(&instance._jvm, 1, &count) != JNI_OK || count == 0) {
|
|
26
31
|
throw std::runtime_error("Failed to retrieve the Java Virtual Machine");
|
|
27
32
|
}
|
|
33
|
+
#endif
|
|
28
34
|
}
|
|
29
35
|
return instance._jvm;
|
|
30
36
|
}
|
package/package.json
CHANGED
package/lib/index.d.ts
DELETED
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {} from 'react-native-nitro-modules';
|