GeolocatorPlugin
GeolocatorPlugin copied to clipboard
Concurrent calls to `GetPositionAsync` cause indefinite GPS reading
Bug Information
Version Number of Plugin: 4.5.0.6 Device Tested On: Google Pixel Simulator Tested On: None Version of VS: 7.5.4 Version of Xamarin: Android 8.3.3.2
Steps to reproduce the Behavior
Have two threads await GetPositionAsync
concurrently.
Expected Behavior
Both calls return and GPS radio is powered down (i.e., icon disappears from Android notification bar).
Actual Behavior
Both calls return, but GPS radio stays powered up (i.e., icon does not disappear from notification bar) -- despite the timeout duration being surpassed and the cancellation token being cancelled. Even after destroying the app the GPS radio icon remains displayed.
I've observed that it can take a few such instances of concurrent calling to cause the behavior noted above. It doesn't happen every time. Do you currently guard against concurrent calls in some way?