Start a new topic

Xamarin PCL or Shared project

Xamarin PCL or Shared project

1 person has this problem


Hi, I have already built your sample for Android and it works perfectly. Now I try to implement the same thing but now for android inside a Shared project (sort of Xamarin project such as portable class library PCL),

I suddenly have an error that I can't really understand. Can I have any sample implementing the same sample in a PCL or Shared project?

Thank you in advance.

Hi,

Can you please send over the error message you're recieving with exact steps on how this can be reproduced.

Greetings

Nicola

Hi @Radacher, sorry for my delayed response. Finally, I got it. the problem was with my debugging device, it didn't have any OpenGL version.

But right now I'm running into another difficulty, I don't really understand how:

=> to get my location: I saw you explanation but it's not clear to me.

=> to show POI that I set in native view using architectView.setLocation(). I follow you tutorial but there is no POI visible on the architectView.

Thanks you all!

Hi Cyrille,
To get your current location, implement the AR.context.onLocationChanged function:

AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){
  //now, add custom functionality to build the AR scene based on the location
  ...
}

 

To show a POI at a certain location, create a new AR.GeoLocation with the lat/lon position you want to show the POI at. Then define your augmentation e.g. a image using the AR.ImageResource and AR.ImageDrawable. To then combine the location with the image, create a AR.GeoObject.
Please have a close look at all our Geo related samples which you can find in our Wikitude SDK example application. They describe all necessary steps in detail. The section 'Point of interest', 'Obtain POI data' and 'Browsing pois' should be very helpful for you!

Best regards

Andreas

Thank you for this advice. But where should I put all this code? In native code or in javascript file?

If I have to write it in javascript, so how can I make a call of it to make it executed? Sorry, I'm really a newby 

Thank you.

Hi Andreas, 

I use a poiWithLabel.js file that I got from github : https://github.com/Wikitude/wikitude-sdk-samples/tree/master/4_PointOfInterest_2_PoiWithLabel/js

then I can't have my location. Inside this file you can see there is already the function AR.context.onLocationChanged implemented. 

Please can you just tell me what is the first step and then second one ?

thank you very much for answering to my questions.

Hi Cyrille,
Architect Worlds are only written in html/js/css, so you have to write your own .html/.js/.css file (like our samples that are part of our SDK package). You load them with our loadArchitectWorld function.

Inside the AR.context.onLocationChanged function you can code whatever you want.

Best regards

Andreas

Hi, Andreas,

I'm acctually working with Cyrille now. These details below may give you more information.  

At the beginning, we tried added Wikitude into project via Xamarin Component in Visual Studio, and we open the sample that came with Wikitude. It works fine on mode Tracking2D.

Then, we kept the project structure of precedent sample, and tried simply:

1. copy files of another sample into Visual Studio work space. ( https://github.com/Wikitude/wikitude-sdk-samples/tree/master/4_PointOfInterest_2_PoiWithLabel )

2. add them into project.



3. replace the URL which indicate the location of index.html of the new sample.

4. change the feature Tracking2D to Geo.



5. call architectView.setLocation() with a random location ex. (49.383893, 1.077791, 100, 1).

4. invoke architectView.load(URL).

After those steps, there is still no POI on the screen. Could you please tell us whether there is any unconvenient step we've done? Should we put an actual location to the function? 

 

Thanks.

Hi Yuhao,
Thx for the detailed information.
When calling the setLocation method, you should inject your current position. In a production application, you need to implement the GPS handling like we did in our Wikitude Android Architect SDK example application.

If you inject an arbitrary location, you might not see the Poi because it's to far away, above or below you. When in doubt, don't specify a altitue at for testing purposes.

Best regards

Andreas

Hi Andreas,

Thx for your patience.

I currently work with Cyrille and Yuhao. We have tried with getting our current position but there is no POI on the screen. I have tried some console output in locationChangedFn function in order to verify that the function is called. But when we setLocation with our current position, the locationChangedFn is not called. Do you have any idea?

here is some code if you are interested:

var World = {

  ...

 locationChanged: function locationChangedFn(lat, lon, alt, acc) {

 console.log("===================================================================");

 console.log("lat: " + lat);

 console.log("lon: " + lon);

 console.log("===================================================================");

 ...

 },

 ...

};

 

AR.context.onLocationChanged = World.locationChanged;

Hi Yuan,
To speed up this question, can you send us a project demonstrating your issue? We will then have a look at it and report back to you what we found out.

Best regards

Andreas

Hi Andreas,

Here is the url github:https://github.com/jiyuan312986471/Test

Thanks

 

THX, I will have a look at it and get back to you once I have a workaround/fix for you.

Best regards

Andreas

Hello,

I need to Launch Wikitude from my PCL dependency injection interface. On the iOS side I have the following code. I'm not sure how to actually Launch Wikitude from here. Can someone guide me?


[assembly: Xamarin.Forms.Dependency(typeof(AugmentedRealityImplementation))]
namespace UXDivers.Artina.Grial
{
    public class AugmentedRealityImplementation : IAugmentedReality
    {
        public AugmentedRealityImplementation() { }

        public void LaunchWikitude()
        {
            var composer = new WikitudeSDKExampleViewController(IntPtr.Zero);

        }
    }
}

 

Login or Signup to post a comment