Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

using Plugin.Geolocator on Android gives wrong Lat and Longitude uwp works properly

Dwains102Dwains102 Member ✭✭
edited July 2 in Xamarin.Android

I set the Android manifest for location permissions.
I added the following to OnCreate in myAcivity in Android

         ` protected override void OnCreate(Bundle savedInstanceState)
    {
        Bundle abundle = new Bundle();
        Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, abundle);

        TabLayoutResource = Resource.Layout.Tabbar;
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(savedInstanceState);

        Xamarin.Essentials.Platform.Init(this, savedInstanceState);
        global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
        LoadApplication(new App());
    };

 public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
    {
        PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
    }`

When the app is run it gives the wrong Latitude and Longitude but uwp works. Any ideas?

Best Answer

Answers

  • Dwains102Dwains102 Member ✭✭

    Thanks will try it on real device

  • Dwains102Dwains102 Member ✭✭

    Thanks ColeX it does display correctly when installed on device. You da Man!

Sign In or Register to comment.