Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PositionError event is not raised when GPS is disabled in device settings (Android) #320

Open
mindphaser opened this issue Jan 28, 2020 · 0 comments

Comments

@mindphaser
Copy link

Bug Information

Version Number of Plugin: 4.6.2.1
Device Tested On: Android emulator, base device: Pixel XL, Android 9.0, API 28
Simulator Tested On: Android emulator, base device: Pixel XL, Android 9.0, API 28
Version of VS: 16.4.3
Version of Xamarin: 16.4.000.308 (d16-4@4755fb3)
Versions of other things you are using:

Steps to reproduce the Behavior

  1. Use await CrossGeolocator.Current.StartListeningAsync(), subscribe to events PositionChanged and PositionError.
  2. When app is running, go to device location settings and disable location.

Expected Behavior

When location is disabled, event PositionError should be raised.

Actual Behavior

PositionError is not raised because passive provider is added to GeolocationContinuousListener

Code snippet

Fix:
In file GeolocatorImplementation.android.cs line 325 (just before listener = new GeolocationContinuousListener(Manager, minimumTime, providers);):

var providers = Providers;
replace with:
var providers = Providers.Where(p => !IgnoredProviders.Contains(p)).ToArray();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant