cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Charbonneau <amcha...@gmail.com>
Subject Re: Cordova Plugins with Native Callbacks
Date Fri, 19 Apr 2013 17:20:33 GMT
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 <amcharbo@gmail.com>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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message