jamesmontemagno / GeolocatorPlugin

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

The plug-in does not work after it is published on Google Play Store #282

Closed MarcoSal closed 6 years ago

MarcoSal commented 6 years ago

I have a strange behavior. I'm creating an xamarin.forms solution using the Montemagno Geolocator plugin. https://github.com/jamesmontemagno/GeolocatorPlugin. In debug mode everything is fine.

I have this API configuration: "Compiled Used Android Version: API27", "Minimun Android to Target: API21".

If I put "Target Android version: API27" the plugin geolocator always returns me error 'not Available'. If I put "Target Android version: Use Compile using SDK version" everything is ok but Google Play Store does not accept it because from August 1st it wants at least API26.

where is the error?

Bug Information

Version Number of Plugin: 4.2.0 Device Tested On: Samsung A5 2016 Simulator Tested On: Version of VS: 15.8.7 Version of Xamarin: Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

MarcoSal commented 6 years ago

UPDATE****

I read the interesting article of montemagno https://blog.xamarin.com/android-apps-google-play-target-api-level-requirements/

So I updated vs2017 to the latest release, I have updated all the nuget packages included: Xamarin.Forms.GoogleMaps, Plugin.CurrentActivity, Xam.Plugin.Geolocator, Xam.Plugin.Media.

Montemagno say "These must be set to a specific version and cannot be set to “Use Compile Version”, but, in my smartphones, the locator only works if I use the setting “Use Compile Version”. If I use montemagno settings, I get locator.IsGeolocationAvailable = false!!

it work if i use android:targetSdkVersion="25"...

MarcoSal commented 6 years ago

I have updated everything, visual studio, NUGET, Android SDK. Now I have the problem on the Android emulator with target API27. If I set the target to "Use Compile Version" (i use SDK API27), geolocator will work but Play Store will not accept the APP for the new policy ...

jamesmontemagno commented 6 years ago

You need to set permissions and ensure you have geolocation permissions before using the library at all: https://jamesmontemagno.github.io/GeolocatorPlugin/GettingStarted.html