Search code examples
javascriptjavaandroidwikitude

Wikitude: communicate back from within HtmlDrawable to Java code using "architectsdk://" technique


I'm working on an Android app and trying to implement the following solution:

within an HtmlDrawable I have a set of elements with onClick events.

By clicking on these elements I want to communicate back to the Java code of the app using the "architectsdk://" url technique.

But I don't see any response in my ArchitectView.ArchitectUrlListener() implementation.

Another note: when I set onClick event of the HtmlDrawable itself then I successfully notified within the Java code.

So the question: is it possible to communicate back to Java code from an HtmlDrawable or I need to create each element separatly and places onclicks on them?

Thanks in advance.


Solution

  • I've got an answer on the Wikitude's forum:

    In case if someone needs it:

    HtmlDrawables live in a different context, you therefore cannot use architectsdk to communication with native Android/iOS urlListener. I recommend using HtmlDrawables onClick listener instead.

    e.g. myHtmlDrawables.onClick = function() { document.location="architectsdk://mydrawables?clicked=1"; return true; }

    Best regards