Start a new topic

How to Exit World in Wikitude

How to Exit World in Wikitude


Hi Andreas.

I'm calling that method via cordova through the onUrlInvoke.

The AR World path direction stays the same as document.location('architectsdk://').

Regards,

Joao

I'm so glad that you found a solution!

Just for clarification: are you calling window.location.replace from withen the architect world code or the cordova code?

Best regards,

Andreas

SOLVED IT!

For future reference (in case anyone needs it), the correct method to change from the AR World to another page in the phonegap world is 

window.location.replace(PATH)

either window.location or document.location will trigger a cordova error catching undefined "location" and therefore will not work.

 

Thank you for all your help Andreas.

The thing is, until the app gets to the ARchitect World, the user goes through 4 pages before and all of that works fine.

The only thing that doesn't work is to change from the AR World into a page again.

Regards,

Joao

I'm definetly the wrong person to talk to when it comes to JQuery, sorry :(

If I would be at your position, I would try to do the web page change in an isolated cordova application, like I wrote before. Once this works I would continue with everything else.

Best regards,

Andreas

Hum... since this is not related to the sdk, is ot possible to be because of JQuery?

Regards,

Joao

this looks fine. previously you wrote 'architectsdk://../index.html -> this would be wrong.

When you're insede onURLInvoked, it's standard web development to change web page. I'm afraid I can't help you from that point on as this is then not related to our sdk anymore.

Did you already tried to change the cordova web page without any invocation of our plugin? Just create a new cordova plugin and try to change web pages using document.location.

Best regards,

Andreas

Hi Andreas.

That's what I am doing at the moment.

I have the parser in the ARchitect World:

<script>
function closeWikitudePlugin(){
document.location = 'architectsdk://action=closeWikitudePlugin';
}
</script>


 

And then in the cordova app:

onURLInvoked: function(url) {

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

 

Could you tell me what is wrong in here?

(relative path directs to index page as a reference for testing)

 

Regards,

Joao

architectsdk:// is just use to communicate information from architect to cordova. You don' use it to load a different web page in cordova directly. If your architect world would like to load different web pages in cordova, you can pass it as parameter to architectsdk:// but you if you want to load a different web page in cordova, then you need to call document.location in a .js file that was loaded by your cordova application.

document.location = 'architectsdk://' is only written in architect worlds. it only exists to enable data transfer between architect and the outer world (in your case cordova)

 

if you want to load a different web page in cordova, you need to call document.location in the context of your cordova application. this can not be done within the architect world!

Best regards,

Andreas

 

So, the URL shou then be document.location = 'architectsdk://../index.html';

?

Thank you. The presentation does present a clear overview of how the callbacks should be implemented.

However, I do have the document.location in the onUrlInvoked in the cordova JS file and it still doesn't seem to be working. Should I make a customized callback just to handle the change of location?

Regards,

Joao

Hi Joao,
The second document.location call needs to be done in the cordova related JS code, not in the Architect World. It seems like you would change the document location in the Architect web view and not in the cordova web view. 

Maybe this presentation is helpful as well.

Best regards,

Andreas

Hi Andreas.

Yes, the test I was doing with the relative path would direct the app to the main cordova file (and that is close to the path I want the app to go to, given that the directory is the same).

In my ARchitect World HTML file i call the sdk to close it like this:

<script>
function closeWikitudePlugin(){
document.location = 'architectsdk://action=closeWikitudePlugin';
document.location('../index.html');
}
</script>

 

the document.location with the relative path was just added to desperately try and solve this (needless to say, not successful), however this is the way I'm calling it.

 

Regards,

Joao

The url that is passed to the onURLInvoked method is the one you assigned in your architect world when calling document.location = architectsdk://.

The relative path that you used in the snippet refers to the main cordova .html file. are you sure that this is the correct path?

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