Start a new topic

Open ARWorld on the current webview

Open ARWorld on the current webview

1 person has this problem


Well, i got a workaround , if you want to use the same webview using cordova you need to install the plugin crosswalk. this redirect the wikitude plugin on the same webview. downside its that its dificult to debuging.
 

Hi, im using cordova and ionic to create a simple Geo app.
I want to open a "native" view when i click on the POI

i do have the callbacks and in fact open the view but, the AR its displayed (because its different webview).
i try close and hide the ARView, but i want to go back after the detail view is closed.

any ideas in how can i open the plugin on the current webview??

this is on a method inside a controller:

 $cordovaGeolocation.getCurrentPosition(posOptions)

            .then(function (position) {

              console.log(position);

              var plugin= cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");

                  plugin.loadARchitectWorld(function successFn(loadedURL) {

                    plugin.callJavaScript('World.init('+position.coords.latitude+','+position.coords.longitude+',"'+ id +'");');

              }, function errorFn(error) {

                    alert("Sorry!. Try later.");

              },'path/to/url', , {"camera_position": "back"});

              plugin.setLocation(position.coords.latitude,position.coords.longitude,position.coords.altitude,10);

              plugin.setOnUrlInvokeCallback(function(url)

                {

                  if(url.indexOf('details') > -1){

                      var id = url.substring(url.indexOf('=')+1);

                      //plugin.hide();

                     // Navigation.goNative('details', {poiID:id}, 'left'); 

                      $state.go('details',{poiID:id,catName:name}); 

                  }

                });

Hi Jose,
Thx for sharing your solution with the community!

Best regards,

Andreas

Hi Jose and Andreas,


I tried to use the crosswalk cordova plugin, but I still have two webview generated : a initial webview, and a AR webview launched by the wikitude plugin.


@Andreas : is there a way to make the cordova object and plugins directly accessible from the AR webview ? Or to directly add the AR World in the initial webview ?


Thanks,


Amaury.

@Wikitude : is there a way to make the cordova object and plugins directly accessible from the AR webview ? Or to directly add the AR World in the initial webview ?

Hi Amaury,

The Wikitude Cordova plugin will always use it's own web view. There is no way to directly use either cordova or Architect commands in one combined web view. You can however communicate between these two web views with the help of the Wikitude cordova plugin? Is that something you're interested in or was the question about a general fusion of those two web views.


Best regards,

Andreas

Hi Andreas,


The second part of my question was about the fusion of the two webviews, and you answered it, thanks.


The first part is about accessing the cordova object and plugins from the AR View. Is there some way to do that ? Like with this cordova plugin.


I did some extended tests on my side, and the best I can achieve, is too access the cordova object from the AR View on iOS. The problem is that I never have the deviceReady event, so I guess cordova initialization is not complete on this WebView.


About the way to communicate between the two WebViews, are these the only two solutions ?

  • From the AR view : to call document.location = "architectsdk://aCommande?someParam=value"
  • From the cordova view : to call app.wikitudePlugin.callJavaScript("someARFunction()");

Thanks,

Amaury.

Up ?

Hi Amaury,

Sorry for the late response, but somehow I didn't got the notification that you replied.


Currently the best thing you can do is what you already wrote: use the document.location = ... mechanism to get from Architect -> JS and then callJavaScrpt to get back into the Architect World.


I will have a look at the plugin you mentioned because it looks really interesting, but don't wait for a official support of this in the near future as our roadmap for 2017 is already quite full.


Best regards,

Andreas

Hi Andreas and thanks for your answer. 


To be clear and close this topic, could you answer exactly these two questions (don't hesitate to ask me if these are not clear) :

- is there a way (even complicated) to access cordova object + plugins from the AR View ? 

- are the two mechanism your mentionned the only way to pass data from the Cordova View to/from the AR View ?


Sorry to insist and ask for clarity on these points, but your answers are important for us as we are spending time to build a Ionic 2 bridge between the AR and Cordova view. We are building this bridge on top of what Wikitude allows, then any extra information about what WIkitude is allowing is gold for us at the moment.


Thanks,


Amaury.

Hi Amaury,

Sorry for the late response! Here are your answers (Which I'm happy to answer, don't worry; )):


1) I would say no. You might be able to pass some objects from Cordova to Architect, but all Cordova runtime events (I don't know what they do in the background) I don't expect to work. I'm also pretty sure that calls to `require` would not work. In short, Cordova and Architect live in two different web views which comes close to two separate processes.

2) With SDK 6.1 we will introduce a new way to communicate from Architect to the hosting application by passing a JS object that can be converted to a JSON object. This object is then available in the hosting application. In theory it doesn't offer more functionality, but a more easier interface which can be used even if the web view does some internal layouting.


Best regards,

Andreas


1 person likes this

Hi Andreas,


Thanks a lot for these precises answers. We now have all the inputs to start coding confidently :-)


Hope that the SDK 6.1 will be released soon.


Cheers,


Amaury.





Hi Amaury,

I'm glad you have all information you need. 

If everything goes well, 6.1 will be released by the end of this month.


Best regards,

Andreas

Login or Signup to post a comment