-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext7.json
More file actions
37 lines (37 loc) · 1.9 KB
/
context7.json
File metadata and controls
37 lines (37 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
"$schema": "https://context7.com/schema/context7.json",
"url": "https://context7.com/androidgolab/jni",
"public_key": "pk_ajlVZor26lzvjspOfyEJd",
"projectTitle": "go-jni: Android Java API Bindings for Go",
"description": "Idiomatic Go bindings for 53 Android Java API packages via JNI, with typed wrappers for Bluetooth, Location, WiFi, Telephony, ContentResolver, Notifications, and more",
"folders": [
"docs",
"examples/gio",
"examples/gomobile"
],
"excludeFolders": [
"ref",
"raw",
"tools",
"spec",
"templates",
"capi",
"internal",
"proofs",
"tests"
],
"rules": [
"All JNI operations must run inside vm.Do(func(env *jni.Env) error { ... }) for thread safety",
"Local references are only valid within a vm.Do() scope; convert to GlobalRef with env.NewGlobalRef() if needed outside",
"Always defer mgr.Close() after creating any Manager to release the Java GlobalRef",
"Use env.NewStringUTF() to convert Go strings to JNI, and env.GoString() for JNI to Go",
"Generated packages cache method IDs via ensureInit(); prefer typed wrappers over raw JNI calls",
"Java exceptions are automatically converted to Go errors by all Call*Method functions",
"For callbacks on Java interfaces, use env.NewProxy() to create a java.lang.reflect.Proxy",
"For callbacks on abstract classes (BroadcastReceiver, ScanCallback, etc.), use a Java adapter class with GoAbstractDispatch + jni.RegisterProxyHandler on the Go side",
"env.NewProxy() only works for Java interfaces, NOT abstract classes -- see broadcast-receiver.md for the abstract class pattern",
"Create a HandlerThread with its own Looper when registering listener callbacks",
"CallBooleanMethod returns uint8; convert to Go bool via resultRaw != 0. BooleanValue() takes uint8, not Go bool",
"See general-patterns.md for guidance on Android APIs not covered by specific examples"
]
}