Start a new topic

Button is not working

hi,


I have implemented the button into the code and when I click on the button its not redirecting to the url on that button.

var World = {

loaded: false,



init: function initFn() {

this.createOverlays();

},


createOverlays: function createOverlaysFn() {

/* Initialize ClientTracker */

this.targetCollectionResource = new AR.TargetCollectionResource("assets/tracker-11.wtc", {

            onError: function(errorMessage) {

            alert(errorMessage);

            }

});


this.tracker = new AR.ImageTracker(this.targetCollectionResource, {

onTargetsLoaded: this.worldLoaded,

            onError: function(errorMessage) {

            alert(errorMessage);

            }

});

var video = new AR.VideoDrawable("assets/AtmoSkyVid.mp4", 0.8, {

translate: {

x: 0.989,

        y: 0.159,

              

}

});

     

      var playButtonImg = new AR.ImageResource("assets/buyNowButton.png");

      var playButton = new AR.ImageDrawable(playButtonImg, 0.3, {

        enabled :true,

var pageOne = new AR.ImageTrackable(this.tracker, "*", {

drawables: {

cam: [video, playButton]

},

onImageRecognized: function onImageRecognizedFn() {

if (this.hasVideoStarted) {

video.resume();

                  World.playButton.enabled =true;

                  //World.playButton.onClick() ;

                  

}

else {

this.hasVideoStarted = true;

video.play(-1);

}

World.removeLoadingBar();

},

onImageLost: function onImageLostFn() {

video.pause();

},

            onError: function(errorMessage) {

            alert(errorMessage);

            }

});

      

      

},

  


worldLoaded: function worldLoadedFn() {

var cssDivInstructions = " style='display: table-cell;vertical-align: middle; text-align: right; width: 50%; padding-right: 15px;'";

var cssDivSurfer = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px; width: 38px'";

var cssDivBiker = " style='display: table-cell;vertical-align: middle; text-align: left; padding-right: 15px;'";

document.getElementById('loadingMessage').innerHTML =

"<div" + cssDivInstructions + ">Scan Target &#35;1 (surfer) or &#35;2 (biker):</div>" +

"<div" + cssDivSurfer + "><img src='assets/skyLogoThumb.jpg'></img></div>" +

"<div" + cssDivBiker + "><img src='assets/FooMT.png'></img></div>";

      alert("worldLoadex"+JSON.stringify(this.worldLoaded));

}

};


World.init();


Hi Amway,


Could you please provide further details on the issue:

  • Which version of the SDK are you using?
  • Are you using the JS API?
  • Are you using any of our Extensions (Titanium, Cordova, Xamarin, Unity)? If yes, which version are you using?
  • Is there any crash log
  • What device does this happen with (os Version and model)?
  • 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?

Thanks

Eva


1 person likes this

Thank you for the questions, Eva.

 

> Which version of the SDK are you using?

We are using the Cordova Extension on version 8.0.0 of the Wikitude SDK.

 

> Are you using the JS API?

Yes.

 

> Is there any crash log

There is no crash log. :(

 

> What device does this happen with (os Version and model)?

iPhone X - iOS 11.4.1

 

> Is this happening with the sample app or in your own app?

This is happening in our own app. 

 

>If it happens with your own app, does the sample app work on your device?

Yes, the sample app works on the iPhone X. When I hit the same code with the Wikitude sample app it works.

 

Video attached


MOV
(7.67 MB)

Hi,


Can you also please share the complete AR experience and also test the AR experience with the Cordova sample app to see if the issue is also happening within the Sample app? 


Thx and greetings

Nicola

Ok, I will show the complete AR experience on both the Wikitude app and in our app with the Cordova SDK 8.0.0


They both look fine, AR content comes up great with both, but the button does not work in our app with the Cordova SDK 8.0.0  It is odd because there are 2 problems with the button.

  • FIRST is that it is hard to press, sometimes it takes 10 times tapping all around the edges of the button to get it to launch the URL.
  • SECOND is that the web page never renders. I just shows a white page with no web content or even a blue bar showing it is loading...

I'll take a video showing the full experience and upload it here.

Here are 2 videos.


One is the iPhone X using the wikitude app running one of your sample AR experiences


The other is using the same phone with the same AR experience but with the Cordova SDK in our app. Both work for AR, but the button only works in the Wikitude app. Code for both hosted at the same endpoint: https://amwy.io/arexamples/01-03/

3gp
mp4
(4.07 MB)

Hi,



have you tried attaching Safari to your running app to check for errors? If not, I'd like you to do just that and check whether there are any messages in the JavaScript console.


Additionally, could you try adding the following line to your index.html file and lettng me know whether that changes anything?


<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">




- Daniel

have you tried attaching Safari to your running app to check for errors?

I have not.  Is that the best way to g


Thanks Daniel! I'll add that line and test it out.

I added the meta tag listed above. It did not fix the issue. 


I tried it in two places.

    For one it caused the AR not to render at all. Removing the line it worked again.

   The second place the AR continued to render but did not fix the button. 


This seems like it may be a Cordova SDK issue. I am reaching out to others that have used the Cordova SDK inside Kony to see if they are having the same issue.


Another user in the same situation came back with this response:


I see that Wikitude is failing to load an additional browser window on top when running with Cordova builds. A simple fix for now is to open the URL link in safari.

In the htmldrawable.js please edit the line - AR.context.openInBrowser(url); to AR.context.openInBrowser(url, true);

 

I think this will need a support ticket with Wikitude, I see this error on execution of AR.context.openInBrowser results in - 2018-10-25 17:32:50.316857-0500 TestProj[426:60003] Presenting view controllers on detached view controllers is discouraged <WTArchitectViewController: 0x149d802a0>.


I have not had an opportunity to test these changes in our platform yet. 

Login or Signup to post a comment