Start a new topic

How to Exit World in Wikitude

How to Exit World in Wikitude


Hi Marton,
I just tested hide() & show() with our latest Wikitude Cordova plugin and Wikitude Cordova example application.

I changed our first example so that it uses the onEnterFieldOfVision trigger to change the document location to:

 

This will then trigger a call to the onUrlInvoked function in your cordova index.js file. There, I just added a call to hide() and show().

What then happens is, that if you open the first example and recognize the target, our plugin is hidden and after one second shown again.

Here is the modified onUrlInvoked function:

```

onUrlInvoke: function (url) {
if (url.indexOf('captureScreen') > -1) {
app.wikitudePlugin.captureScreen(
function(absoluteFilePath) {
alert("snapshot stored at:n" + absoluteFilePath);
},
function (errorMessage) {
alert(errorMessage);
},
true, null
);
} else {
//alert(url + "not handled");
app.wikitudePlugin.hide();
setTimeout(function(){app.wikitudePlugin.show();}, 1000);
}
}

```

I tested it with an Android 5 device and our latest SDK + Cordova extension. Which hardware & Wikitude sdk version are you using?

Best regards,

Andreas

I tried hide function but still that is not the behavior I wanted. On the onUrlInvoke that I have: 

document.location = 'architectsdk://onUrlInvoke?gacode=B001&status=1

And my hide function:

document.location = 'architectsdk://hideButton?status=hide';

 

Is there anything wrong with my hide function? Is there a way to pass a different gacode or status parameter? It always redirects to the onUrlInvoke function in my AR.js.

 

Regards,

Miguel

Dear Andreas,

Thanks a lot for your extensive support!

Since then, we decided to develop our AR project on Unity and Vuforia, but its good to know that it's working. :)

Thanks again,

Marton

Hi Andreas.

This fix works great. Just a very simple question from here on:

on the onURL Invoked method, after we close the plugin, would a simple window.location('index.html');

change the path of where the app is?

After searching, I haven't found anything that will comply to the back behavior I wanted. However, the Android Device Button Works just fine. I checked that there are codes in WikitudePlugin.java . Is there a way to call the method removeArchitectView(); 

from the WikitudePlugin.java in my index.html?

I have a div on the html,which is present on the AR view that handles the "going back" function:

<div id="backButton"  class="bottom" onclick="document.location = 'architectsdk://actionButton?status=hide';"><img width='25%' src='backbutton.png'></div>

I hope you can give me response.


Thanks,  

Miguel

Hi Marton,
Can you add some alerts in the WikitudePlugin.js function onWikitudeOk and onWikitudeError? The hide method is implemented on Android and should report an error if something unexpected happens internally.

Best regards

Andreas

Hi Joao,
By 'where the app is' you refer to if the Cordova or Wikitude Plugin view is displayed or which web page is loaded (in either Cordova or the Architect web view)?

If your question is about how to close the Wikitude Plugin, you need to call something like app.wikitudePlugin.close();. Changing the window location does not affect if our plugin is shown or not.

I'm not quite sure if I understood your question correctly, so please don't hesitate to follow up with a new question.

Best regards,

Andreas

I still need to figure this out. I can send some files for you to look at it. We need a back button for iOS version of the app. WE BOUGHT A LICENSE AND WE WOULD LIKE TO RECEIVE SUPPORT FROM YOU. I need a way to determine the parameters in urlinvoke. Thanks.

Hi Andreas!

Thank you for your answer and I apologize for the "newbie language" used. And yes, I want the app to navigate to a different page in the cordova view once I close the ARchitect View.

The ARchitect View already closes. However, it goes back to the HTML file that had the index.js embedded. Should I post a different question for that?

Once again, thank you very much for your help. This post has helped me more than the last 2 days of searching :)

Hi Joao,
Once the Architect View is closed, navigating in the cordova application can be done independently from the Wikitude Plugin. I'm not a expert in web development, but I heard/read that changing the location might not be the most elegant solution. I could forward the question to our web devs if you want to, they should be able to help you out.

Does calling the 'close' function of our SDK trigger a page redirection/reload of the cordova application? Was there a different page loaded at the moment when you 'opened' the Wikitude Plugin?

Best regards,

Andreas

Hi Andreas.

That would be great if you could redirect it.

What happens is that I embedded the index.js in a page, and the index.js file has the URL for the Architect View, which naturally is a different page. I used the method you described (app.WikitudePlugin.close()) and it works, and again naturally, it goes back to the page where the the index.js was embedded.

 

Best Regards,

Joao Pratas

Hi Joao,

I guess I understood now:  What you want is that after the Wikitude Plugin is closed, a different page is shown in the cordova application?

Best regards,

Andreas

Hi Andreas.

Exactly. I'm creating a game with a quite linear navigation and the ARchitect View should then lead the user to a different page. :)

Regards,

Joao

Hi Joao,
did you tried to call document.location = 'your/custom.html' instead of window.location (in your cordova js file that closed the wikitude plugin)?

Best regards,

Andreas

Hi Andreas.

Yes I just tried it and it still doesn't work. I was trying to redirect the app to the start of the application, but not successfully.

My guess is that it's something that has to do with the way i set this up in javaScript:

 

onURLInvoked: function(url) {

app.wikitudePlugin.close();
document.location('../index.html');
},

 

something tells me that that URL at the top has to come from somewhere.

Any suggestions?

Regards,

Joao
Login or Signup to post a comment