jamesmontemagno / GeolocatorPlugin

Geolocation plugin for Xamarin and Windows
MIT License
293 stars 158 forks source link

Geolocator StartListening issue with IOS 12.0 #279

Open karant0007 opened 6 years ago

karant0007 commented 6 years ago

Hi James i have implemented this plugin for my project, this startListening method is working fine with ios 11.4 But this method is not listing any location changes with IOS 12.0

Bug Information

Version Number of Plugin: version 4.5.0.6 Device Tested On: IPhone 7 Simulator Tested On: IPhone 8 Plus

Steps to reproduce the Behavior

Run this code in IOS 11.4 simulator / device Then try to run in IOS 12.0 simulator / device

Expected Behavior

Work properly same as older version of ios

Actual Behavior

in IOS 12.0 it's PositionChanged event is not trigger while driving one place to another.

Code snippet

var locator = CrossGeolocator.Current;
await locator.StartListeningAsync(new TimeSpan(0, 0, 1, 1), 1, true, new Plugin.Geolocator.Abstractions.ListenerSettings
                    {
                        ActivityType = Plugin.Geolocator.Abstractions.ActivityType.AutomotiveNavigation,
                        AllowBackgroundUpdates = true,
                        DeferLocationUpdates = true,
                        DeferralDistanceMeters = 1,
                        DeferralTime = TimeSpan.FromSeconds(1),
                        ListenForSignificantChanges = true,
                        PauseLocationUpdatesAutomatically = false
                    });

locator.PositionChanged += Locator_PositionChanged;
locator.PositionError += (sender, args) =>
                {
                    if (args.Error == GeolocationError.Unauthorized)
                    {

                    }
                    Debug.WriteLine(args.Error);
                };
vecalion commented 6 years ago

@karant0007 I see that there are a lot of complains that GPS doesn't work properly on iOS 12. I wonder if this is the same issue. Here is something to try: https://www.imobie.com/support/fix-ios-12-gps-issues.htm

karant0007 commented 6 years ago

Hi @vecalion Thanks for reply is there any way to handle this programatically?

MaximeMohandi commented 6 years ago

Hi @karant0007 the function MoveToRegion works for you or is just the location change ?

ctrlemo commented 5 years ago

Hi @karant0007 I experienced the same issue when listening from location changes on IOS 12.1 simulator. But when I run it on my phone with IOS 12.1 the PositionChanged gets triggered as expected.

So I think the issue is on the simulator only.