Forum Xamarin.iOS

in GeoLocator if screen will lock than app is crashing

abhay27abhay27 Member ✭✭
edited November 2018 in Xamarin.iOS

Hello Team,
I am using Geolocator for fetching current location. so when a screen is on at that time everything is fine but when screen off then when we on screen again app is crashing.
there is my code:

          public async void CurrentLocation()
                await CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(10), 0, true, new Plugin.Geolocator.Abstractions.ListenerSettings
                ActivityType = Plugin.Geolocator.Abstractions.ActivityType.AutomotiveNavigation,
                AllowBackgroundUpdates = true,
                DeferLocationUpdates = true,
                DeferralDistanceMeters = 1,
                ListenForSignificantChanges = false,
                PauseLocationUpdatesAutomatically = false


            CrossGeolocator.Current.PositionChanged += changedPosition;

I have given all permission for location but in only iOS, this issue is occurring.
Please help and thanks in advance.


  • LandLuLandLu Member, Xamarin Team Xamurai

    What error messages did you get?
    If you remove this location query code, would your app crash from screen off to on? What's your code in changedPosition? Maybe it could cause this issue. Also did you place some code in App's life cycle event OnResume()?
    Or you can try to provide your sample to help us reproduce this issue, since this plugin works fine on my side.

Sign In or Register to comment.