Start a new topic

Image recognition Listener

Hi,


We use Wikitude studio to create experiences and use them within an iOS app with JS SKD.

It is possible to be notified of the recognized image names ?


Thanks, 


Hi Martin,


If I understand correctly, you can get the name of your target by using

this.targetName


For more information please review our Javascript API here.


Thanks,

Eva

Thank you for the feedback.


Right now we create offline experiences with Wikitude Studio, they are loaded dynamically within a native app using the Javascript SDK for iOS.


To be more precise, what I am looking for is something similar to this :

Being notified by the WTArchitectViewDelegate in my native code (iOS, Swift) with a function

func architectView(_ architectView: WTArchitectView, didRecognizeImage targetProperties : [AnyHashable : Any]).


I understand we could detect that with the Javascript API, however what I need is to find a way to notify the native code about actions happening inside the WTArchitectView, and then perform actions outside of the WTArchitectView, without changing the offline experience .zip file.


Thank you for your help


Hi Martin,

You can communicate from JS to ObjC with the following mechanism.

In you Architect World, call `AR.platform.sendJSONObject()` (You can pass any data that you want) and implement the WTArchitectViewDelegate method `architectView:receivedJSONObject:` to get this custom data. Please refer to our example app for additional details (Capture Screen, Native Detail Screen, Save/Load Instant Target are using this mechanism).


Best regards,
Andreas Schacherbauer

That's perfect thank you very much.


I was able to update the onTargetRecognized function to call my delegate and it works like a charm.


It would be even better if it was by default in the template.js from the .zip created by Wikitude Studio.


Thank you again,

 

Login or Signup to post a comment