Start a new topic

Wikitude Javascript sdk click event

Hi,

I am using Wikitude javascript sdk using swift language, when I push the app to the background I am stopping the wikitude rendering and when app comes to the foreground I start the wikitude but sometimes when I come to the foreground from background the click event is not working.Could you help me with this issue.


Hi ,


Any update on this?.


Thanks,

Sowmiya.N.P.

Hi Team,


I still facing the issue, the click event is not getting triggered . Is there any swift example with wikitude javascript sdk. I could only find objc sample projects.


Thanks

Hi,


Is your click event in Javascript, or in the native code? You mention making calls to Javascript using Swift, so I assume you are using the callJavascript() method in our WTArchitectView.


In that case, I couldn't reproduce this issue in our sample app. You should be checking if the SDK is running and calling the JS function where it's appropriate.


For instance, I declared this function inside the World object in the Javascript file of an AR experience:

buttonPressed: function buttonPressedFn() {
    alert("Button pressed");
},


From the native side, I then use the callJavascript() function where needed:

if (self.architectView.isRunning) {
    self.architectView.callJavascript("World.buttonPressed()")
}


After sending the app to background and bringing it to foreground again multiple times, and then calling this native code, Javascript still responds as expected.


The native receivedJSONObject() function you mention would not get called in this case. That one gets called when you use AR.platform.sendJSONObject() in your Javascript code, the opposite from the example above. For instance, with this:

AR.platform.sendJSONObject({
    action: "call_native"
});


The receivedJSONObject() function would be called in Swift, receiving a dictionary that includes the "call_native" string.


I you are still having trouble, please include a sample of your Javascript and Swift code.



- Damian

I am using wikitude javascript sdk 8.9, and ios version12.0. The startWikitudeSDKRendering is getting called when notification didbecomeActiveNotification is called, and i am able to scan the posters, but only the click event is not getting triggered. And i am making the calls to javascript using swift language and so receivedJSONObject function is not getting called.

Hi,


Can you please provide the following details:


  • Which version of the SDK are you using?
  • What device does this happen with (model details and OS version)?
  • Is this happening with the sample app or in your own app? If it happens with your own app, does the sample app work on your device?
  • Did you check the logs and state of the app when the issue happens? As you mentioned that the issue is only happening sometimes and not constantly.


Please note that I will close the other forum thread started, which is dealing with exactly the same questions, to ensure that we can work efficiently and don't do double work.


Thx and greetings

Nicola


Login or Signup to post a comment