Skip to content

Commit 6fa850c

Browse files
xaionaro@dx.centerxaionaro@dx.center
authored andcommitted
docs: improve Context7 docs for Bluetooth, BroadcastReceiver, and general patterns
Address feedback on documentation gaps: - bluetooth.md: Add complete BluetoothAdapter acquisition flow, startDiscovery JNI signature ("()Z") and CallBooleanMethod usage, end-to-end classic discovery with BroadcastReceiver registration, BLE scanning with GoAbstractDispatch adapter pattern, GATT client/server sections, expanded constants reference. - broadcast-receiver.md: Rewrite with registerReceiver as primary approach. Complete GoBroadcastReceiver.java adapter, Go handler registration, IntentFilter creation, ctx.RegisterReceiver2() call, and cleanup. No longer deflects to alternative APIs. - general-patterns.md: New guide for Android APIs not covered by specific examples. Covers system services, constructors, static methods, interface vs abstract class callbacks, reference management, HandlerThread, JNI signatures, value constructors, common pitfalls. - context7.json: Add rules for abstract class pattern, NewProxy limitation, BooleanValue type, and pointer to general-patterns.md.
1 parent 7a66a96 commit 6fa850c

4 files changed

Lines changed: 1445 additions & 203 deletions

File tree

context7.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"Generated packages cache method IDs via ensureInit(); prefer typed wrappers over raw JNI calls",
2929
"Java exceptions are automatically converted to Go errors by all Call*Method functions",
3030
"For callbacks on Java interfaces, use env.NewProxy() to create a java.lang.reflect.Proxy",
31-
"Create a HandlerThread with its own Looper when registering listener callbacks"
31+
"For callbacks on abstract classes (BroadcastReceiver, ScanCallback, etc.), use a Java adapter class with GoAbstractDispatch + jni.RegisterProxyHandler on the Go side",
32+
"env.NewProxy() only works for Java interfaces, NOT abstract classes -- see broadcast-receiver.md for the abstract class pattern",
33+
"Create a HandlerThread with its own Looper when registering listener callbacks",
34+
"CallBooleanMethod returns uint8; convert to Go bool via resultRaw != 0. BooleanValue() takes uint8, not Go bool",
35+
"See general-patterns.md for guidance on Android APIs not covered by specific examples"
3236
]
3337
}

0 commit comments

Comments
 (0)