Start a new topic

Notice from javascript to BarcodePlugin

Hello. When "Barcode and QR code reader" was executed, the operation slows down as a heavy load is applied to ZBar. Therefore, I want to acquire only several frames with BarcodePlugin.cpp and process it. First, press the screen button. Next, the barcode on the screen is read. Can you notify that you pressed the button from JavaScript to BarcodePlugin.cpp at that time? I apologize if my English isn't very good. Thank you.

Hi Charu,


you can do that by using the AR.platform.sendJSONObject() to send something to java where you can then call a native function and start the barcode scanning there.


e.g: 


Java    

public void onCreate() {
	... 

	architectView.addArchitectJavaScriptInterfaceListener(new ArchitectJavaScriptInterfaceListener() {
            	@Override
            	public void onJSONObjectReceived(final JSONObject jsonObject) {
                	startScan
	        }
        });
}

...

private native void startScan();

     

C++

 

extern "C"
JNIEXPORT void JNICALL
Java_com_wikitude_samples_advanced_plugins_QrPluginExtension_startScan(JNIEnv* env, jobject instance) {

    // TODO

}

 

Best Regards,

Alex

Hello Eva, Sorry, the information was not enough. I use Wikitude SDK Android version 7.1.0. The device uses an Android 5.1 smartphone. When I ran the test program for reading the QR code in the SDKExamples application sample, I felt that processing was slow. It was confirmed from the application sample that data can be passed from BarcodePlugin.cpp to JavaScript. However, I do not know how to pass from JavaScript to BarcodePlugin.cpp. Is it possible to do it? Thanks Charu
Hello Charu,

Could you please report if you are testing in iOS or Android, the SDK version, the mobile device you are testing with and if this is happening with our sample code or with your app?

Thanks
Eva

 

Login or Signup to post a comment