using Android.Content; using Android.Locations; using AndroidX.Core.Location; // ReSharper disable once CheckNamespace namespace System { public static class LocationManagerExtensions { /// /// 获取位置管理服务 /// /// /// public static LocationManager GetLocationManager(this Context context) => context.GetSystemService(Context.LocationService); /// /// 位置开关是否打开 /// /// /// public static bool IsLocationEnabledCompat(this LocationManager locationManager) => LocationManagerCompat.IsLocationEnabled(locationManager); } }