CrossGeeks / GeofencePlugin

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

[Android] System.InvalidCastException #16

Open jws2103 opened 5 years ago

jws2103 commented 5 years ago

Hi,

I've installed the latest version (1.0.1) to Xamarin.Forms(3.5.0.129452) project and followed the same set up what's described in the documentation.

This issue only happens on Android where I'm trying to access CrossGeofence.Current.

Here's a full log what's actually thrown.

at Plugin.Geofence.GeofenceImplementation.RequestPermissions () [0x00000] in C:\Plugins\Geofence\src\Plugin.Geofence.Android\GeofenceImplementation.cs:706 at Plugin.Geofence.GeofenceImplementation..ctor () [0x00031] in C:\Plugins\Geofence\src\Plugin.Geofence.Android\GeofenceImplementation.cs:126 at Plugin.Geofence.CrossGeofence.CreateGeofence () [0x00000] in C:\Plugins\Geofence\src\Plugin.Geofence.Shared\CrossGeofence.cs:131 at Plugin.Geofence.CrossGeofence+<>c.<.cctor>b__55_0 () [0x00000] in C:\Plugins\Geofence\src\Plugin.Geofence.Shared\CrossGeofence.cs:13 at System.Lazy1[T].CreateValue () [0x00081] in <d4a23bbd2f544c30a48c44dd622ce09f>:0 at System.Lazy1[T].LazyInitValue () [0x00023] in :0 at System.Lazy`1[T].get_Value () [0x0003a] in :0 at Plugin.Geofence.CrossGeofence.get_Current () [0x0000d] in C:\Plugins\Geofence\src\Plugin.Geofence.Shared\CrossGeofence.cs:115 at Taskey.Forms.ViewModels.HomePageVM.StartTrackingLocation () [0x00002] in /Users/jaysim/Documents/CrowdCo/Taskey/taskey/Taskey.Forms/ViewModels/HomePageVM.cs:65

Anyone has experienced such issue? It would be great if anyone has workaround for it.

Kind regards, Jay

flaviosuardi commented 5 years ago

Hi, no workaround for this issue: before to call any methods of CrossGeofence.Current you have to grant location permissions. Flavio

jochembroekhoff commented 4 years ago

Looking through some commits, it appears that this issue will have been fixed by #6. It would be useful if there were a pre-release that incorporated this fix.