// setting callback functions that are called when the ARchitect World finished launching or failed. app.wikitudePlugin._onARchitectWorldLaunchedCallback = app.onARchitectWorldLaunched; app.wikitudePlugin._onARchitectWorldFailedLaunchingCallback = app.onARchitectWorldFailedLaunching;
// setting up a callback to communicate from ARchitect into PhoneGap app.wikitudePlugin.setOnUrlInvokeCallback(app.onURLInvoked); // setting callback functions that are called when the ARchitect World finished launching or failed. app.wikitudePlugin.loadARchitectWorld( app.onARchitectWorldLaunched, // onARExperienceLoadedSuccessful, app.onARchitectWorldFailedLaunching, //onARExperienceLoadError, app.arExperienceUrl, app.requiredFeatures, app.startupConfiguration );
/* This combines everything by creating an AR.Trackable2DObject with the previously created tracker, the name of the image target as defined in the target collection and the drawable that should augment the recognized image. */ var pageOne = new AR.Trackable2DObject(this.tracker, "*", {
worldLoaded: function worldLoadedFn() { console.log("CONSOLLE: aa:" + aa); //here I have the correct value 7 $('#progressDiv').remove(); } };
function passData(id) { aa = id; console.log("CONSOLLE: " + id); }
Thanks a lot for any help
Davide
S
Simon 248601
said
over 8 years ago
Hi Davide,
you are calling your passData function to late. Call it in the onDeviceSupported function before you call app.wikitudePlugin.loadARchitectWorld.
Thank you and best regards, Simon
L
LoZio LoZio
said
about 8 years ago
Hello, I have a qestion: does it work on iOs? because in my app it works on Android and doesn't work on iOs. Thanks!
N
Nicola Radacher
said
about 8 years ago
Hi,
Yes you can also load your .wtc e..g from a server dynamically with every start. What is the issue with your iOS experience? Is there an error? does it crash? Please provide as much details as possible on this issue.
Thx and greetings
Nicola
M
Marton Feovenyessy
said
over 7 years ago
Hello Guys,
I have a working phonegap app with Wikitude, but I just cant figure out why my callJavaScript() function is not working.
I would need to call it in my loadAR() function, because the passed parameter has to be able to be changed by the user before the AR world is launched, but I cleaned it up till just putting a Hello to the Console at deviceready, but it still doesnt work...
if ( worldobj.requiredExtension === "ObtainPoiDataFromApplicationModel" ) { navigator.geolocation.getCurrentPosition(onLocationUpdated, onLocationError); }
app.wikitudePlugin.loadARchitectWorld(function successFn(loadedURL) { /* Respond to successful world loading if you need to */ }, function errorFn(error) { alert('Loading AR web view failed: ' + error); }, worldobj.path, worldobj.requiredFeatures, worldobj.startupConfiguration ); }, function(errorMessage) { alert(errorMessage); }, worldobj.requiredFeatures ); }, . . . }
What am I doing wrong?
Thanks in advance for any idea! :)
cheers,
Marton
ps: Im on Android and I dont get any errors, just don't get the console message either...
A
Andreas Schacherbauer
said
over 7 years ago
Hi Marton, console.log does not work within an Architect World. You need to use e.g. alerts() to check whenver or not a function is called.
Best regards
Andreas
M
Marton Feovenyessy
said
over 7 years ago
Hi Andreas,
Thanks for your answer, its good to know that console.log doesn't work in AR world.
My custom function (that is called via calljavascript right before loadArchitectworld on the phonegap side) should set a variable in the AR context. However, I can only have the correct value of this variable if I check it within worldLoaded() and not in createOverlays().
For now I could finally avoid using calljavascript, however this might be an issue for me later.
Thanks and BR,
Marton
A
Andreas Schacherbauer
said
over 7 years ago
Hi Marton, I just realised that you might have a problem with the order of your function calls. .callJavaScript() only works if the ArchitectWorld is loaded. Calling it before does not have any effect as there is no Architect World JavaScript context until the Architect World .html is fully loaded. It is save to use when the Architect World loaded callback is called.
davide lepri
1 person has this problem