jamesmontemagno / GeolocatorPlugin

Geolocation plugin for Xamarin and Windows
MIT License
294 stars 158 forks source link

Remove reference to Xamarin.Android.Support.Compat #339

Closed vividos closed 3 years ago

vividos commented 3 years ago

I recently checked my Xamarin.Forms projects for indirect dependencies and found out that it still referenced Xamarin.Android.Support.Compat somewhere. Investigating showed that it came from the Xam.Plugin.Geolocator NuGet package. It's the last old-school plugin that I'm using, as I could migrate most of it to Xamarin.Essentials. Further investigating showed that this plugin references Plugin.Permissions, which has the Xamarin.Android.Support.Compat NuGet package. All other projects and package references in my project is already using AndroidX.

So there are a few ways out of this dependency, in my favorite order:

  1. Xamarin.Essentials implements foreground listening to location changes: https://github.com/xamarin/Essentials/issues/1447 (the Spec is from me, but I didn't work on the code yet). Foreground listening to location changes is the reason why I'm using this plugin for.

  2. This plugin would get rid of Plugin.Permissions and start using Xamarin.Essentials for permission checking. The Plugin.Permissions 5.0.0-beta already includes Essentials, so why not here, too.

  3. The Plugin.Permissions plugin would get rid of the Xamarin.Android.Support.Compat package and adapt to using AndroidX. For this I would create a separate issue, if necessary and desired.

James, what path do you think I should proceed with?

Bug Information

Version Number of Plugin: 4.5.0.6 Device Tested On: Pixel 3a Simulator Tested On: - Version of VS: 16.8.2 Version of Xamarin: Xamarin.Android 11.1.0.17 Versions of other things you are using: -

vividos commented 3 years ago

I found a way to fix including the old Xamarin.Android.Support packages: I still reference Xam.Plugin.Geolocator version 4.5.0.6, but it has a dependency of Plugin.Permissions version >= 3.0.0.12, but I can manually add Plugin.Permissions in version 6.0.1, which uses the newer AndroidX packages. So this is a workaround for me, closing this issue.