Sorry, stupid question, this is exactly what callbackID is for, I can pass that into native and back into java to know which callback to call.
On Thu, Apr 18, 2013 at 4:33 PM, Aaron Charbonneau <[email protected]>wrote: > Hi, > Does anyone know of any Cordova plugin implementations that do a roundtrip > of callbacks? For example on Android something like: > 1.) JS calls cordova plugin exec function providing a CallbackContext > 2.) Java calls C++ native function, wants CallbackContext called when > that function is complete > > Calling a function defined in the JNI layer when the native function is > complete I’ve got, but what I’m having trouble piecing together is how to > call the correct CallbackContext from there, taking into account threading > and asynchronicity, I assume we need to retain a reference to the correct > CallbackContext, but what is a good way to match the native operation with > that exact CallbackContext? Unique Id passed into the native function and a > dictionary on the Java side? Seems passing custom objects(not classes) > into native is not an option. Curious if anyone has tackled this before. > > Thanks! > Aaron > >
