public void Initialize(LocationAuthorizationType authorizationType, bool allowBackgroundLocationUpdates, bool monitorRegions = false, ILogger logger = null) { _logger = logger; _manager = GetManager(); _manager.AuthorizationChanged += OnAuthorizationChanged; _manager.Failed += OnFailed; _manager.PausesLocationUpdatesAutomatically = false; if (authorizationType == LocationAuthorizationType.Always) { _manager.RequestAlwaysAuthorization(); } else if (authorizationType == LocationAuthorizationType.WhenInUse) { _manager.RequestWhenInUseAuthorization(); } if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0) && allowBackgroundLocationUpdates) { _manager.AllowsBackgroundLocationUpdates = true; } if (monitorRegions) { _manager.DidStartMonitoringForRegion += LocationManager_DidStartMonitoringForRegion; _manager.RegionEntered += LocationManager_RegionEntered; _manager.RegionLeft += LocationManager_RegionLeft; _manager.DidDetermineState += LocationManager_DidDetermineState; } }
public void Initialize(LocationAuthorizationType authorizationType, bool allowBackgroundLocationUpdates) { _manager = GetManager(); _manager.AuthorizationChanged += OnAuthorizationChanged; _manager.Failed += OnFailed; _manager.PausesLocationUpdatesAutomatically = false; if (authorizationType == LocationAuthorizationType.Always) { _manager.RequestAlwaysAuthorization(); } else if (authorizationType == LocationAuthorizationType.WhenInUse) { _manager.RequestWhenInUseAuthorization(); } if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0) && allowBackgroundLocationUpdates) { _manager.AllowsBackgroundLocationUpdates = true; } }
public void Initialize(LocationAuthorizationType authorizationType, bool allowBackgroundLocationUpdates) { _manager = (LocationManager)Android.App.Application.Context.GetSystemService(Context.LocationService); _providers = _manager.GetProviders(false).Where(s => s != LocationManager.PassiveProvider).ToArray(); }
public AuthorizationEventArgs(LocationAuthorizationType authorizationType) { AuthorizationType = authorizationType; }