CrossGeeks / GeofencePlugin

Geofence Plugin for Xamarin iOS and Android
MIT License
48 stars 22 forks source link

Issues testing on emulator #19

Closed ChosenSilver closed 4 years ago

ChosenSilver commented 4 years ago

Is anyone else having issues testing this on an Android emulator targetting sdk 27? 95% of the time I get an error that "You need to enabled Location Services", and the other 5% of the time OnLocationChanged fires nonstop and the OnRegionStateChanged never fires, even when changing the GPS to be in and out of the zone.

I verified Location is turned on within the settings and I have requested the appropriate permissions afaik: Manifest.Permission.AccessFineLocation, Manifest.Permission.AccessCoarseLocation, Manifest.Permission.ReceiveBootCompleted, Manifest.Permission.ReadPhoneState, Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage

nielscup commented 4 years ago

I had the same issue and it was caused by "Locating Method" being set to "Phone only":

1) Settings > search "gps" > Select "Locating Method": Select "High accuracy". Selecting "Phone only" resulted in CommonStatusCodes.ResolutionRequired (code 6).

ChosenSilver commented 4 years ago

I believe in my case it was being caused by the emulator not having access to the internet (corporate firewall). Looking through the source it seems there is a dependency on being able to communicate with Google services, and if you are unable it can be a cause of the misleading error that you need to enable location services