1 Reply Latest reply on Jul 21, 2015 12:28 PM by Chris Child

    native extension: how to startActivityForResult or use a JS-Callbacks

    Tobias Kiefer

      Hello everyone,

       

      I am trying to write my own native extension for scanning barcodes (as Rho.Barcode does not work with ITF Codes on image based scanners).

       

      From javascript I call a method called take(). This method then calls startActivity() on the RhodesActivity. Now my Decoding app starts, I can scan the barcode and thats it.

      The Problem now is, that my original take method returns almost immediately and therefore setting the method result does not work.

       

      I already tried to force the take() call to stay open by using a wait() notify() mechanism until my Decoding Activity sets the result and only then return. The problem with this approach is that as take() does not return right away the screen stays black and I do not even see the Decoding app.

       

      Is there a possibility to simply call startActivityForResult() as in a normal android app and only return from the js call to take() once the onActivityResult() has finished?

       

      Or alternatively, how could I give a js callback to my take() method and call it when I am done? I read the documentation on this but there is no example and I did not know how to get it running.

       

      Best regards,

      Tobi