Compass and Xamarin.forms

DanielCardonaDanielCardona USMember ✭✭
edited February 2017 in Xamarin.Forms

Hi! :)
Im trying to implement the compass https://github.com/JarleySoft/Xamarin.Plugins/tree/master/Compass.

When I try to compile the sample in my iphone, to start to understand how can I implement it on my app, I get this error:
Support for Classic applications (using monotouch.dll) is obsoleted in Xamarin.iOS 10.0+. Please migrate your project to Unified (Project > Migrate to Xamarin.iOS Unified API). (Plugin.Compass.iOS)

I can understand I need to migrate, I seen a step to step in Xamarin.forms page, but, because is just to much at this stage for my knowledge, I'm wondering if some where (I couldn't find it) is an example of working compass in Xamarin.forms that work out of the box, or maybe somebody can helpme to understand how can I manage to make it work...

Thank-you so much!!

Posts

  • BillyMartin.2927BillyMartin.2927 USMember ✭✭
    edited August 2017

    .

  • BillyMartinBillyMartin USMember ✭✭✭

    Hi, Daniel. Did you ever find code examples for the Xamarin forms compass? I'm looking also.

  • DanielCardonaDanielCardona USMember ✭✭
    Hi Bill, yes, it was really easy... sometimes its us that make it complicate, I'm on holidays now but in side days I will response you properly with an example.
  • DanielCardonaDanielCardona USMember ✭✭

    Hil Bill, what you need is to install the pluggin and in the header of you page.cs put "using Plugin.Compass;" , and in you code:

    CrossCompass.Current.CompassChanged += (s, e) =>
    {
        Debug.WriteLine("*** Compass Heading = {0}", e.Heading);
    
        label.Text = $"Heading = {e.Heading}";
    
    };
    
    CrossCompass.Current.Start();
    

    its really easy, if you have any doubt tell-me and I'll try to help the best I can.

  • BillyMartinBillyMartin USMember ✭✭✭

    Thanks. It works on Android, but it's giving me trouble on iOs. How about you?

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    How can I add a pointer to always show user the museum location for example so wherever they go they compass will show the museum location?

Sign In or Register to comment.