Wikitude:使用 "architectsdk://" 技术从 HtmlDrawable 内部与 Java 代码通信

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

我正在开发 Android 应用程序并尝试实施以下解决方案:

在 HtmlDrawable 中,我有一组带有 onClick 事件的元素。

通过单击这些元素,我想使用 "architectsdk://" url 技术与应用程序的 Java 代码进行通信。

但是我在我的 ArchitectView.ArchitectUrlListener() 实现中没有看到任何响应。

另一个注意事项:当我设置 HtmlDrawable 本身的 onClick 事件时,我在 Java 代码中成功通知。

所以问题是:是否可以从 HtmlDrawable 返回 Java 代码,或者我需要单独创建每个元素并在它们上面放置 onclicks?

提前致谢。

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

以防有人需要:

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