Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Disable Compass Calibration Screen in iOS

$
0
0

I'm trying to disable the compass calibration screen from appearing in iOS within my Xamarin.Forms application. I've found the following Xamarin.iOS API method needed to disable the screen programatically:

https://developer.xamarin.com/api/member/MonoMac.CoreLocation.CLLocationManagerDelegate.ShouldDisplayHeadingCalibration/

I am having trouble figuring out exactly how to call it from my Xamarin Forms application.

Here is a C# code snippet of how I'm calling it from a view model in my Xamarin.Forms MVVM application:

#if __IOS__
            var locationManager = new CoreLocation.CLLocationManager();
            locationManager.RequestWhenInUseAuthorization(); // only when in foreground
            //locationManager.RequestAlwaysAuthorization();// always
            locationManager.ShouldDisplayHeadingCalibration += (CoreLocation.CLLocationManager manager) => {return false;};
#endif

Unfortunately this coding solution doesn't work as I'm still seeing the compass calibration screen within my application.

I'm assuming I need to get a reference to the existing core location manager and assign this delegate override there instead of instantiating a new one on every request to load my view model but can't find how to do that in any of the documentation or coding examples.

Any help is greatly appreciated.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>