static IGeofence CreateGeofence() { #if NETSTANDARD2_0 return(null); #else System.Diagnostics.Debug.WriteLine("Creating GeofenceImplementation"); var geofenceImplementation = new GeofenceImplementation(); geofenceImplementation.RequestNotificationPermission = RequestNotificationPermission; geofenceImplementation.RequestLocationPermission = RequestLocationPermission; return(geofenceImplementation); #endif }
public override void OnLocationResult(LocationResult result) { //Location Updated GeofenceImplementation currentGeofenceImplementation = CrossGeofence.Current as GeofenceImplementation; // Check if we need to reset the listener in case there was an error, e.g. location services turned off if (currentGeofenceImplementation.LocationHasError) { // Reset the broadcast receiver here currentGeofenceImplementation.AddGeofences(); // Reset currentGeofenceImplementation.LocationHasError = false; } foreach (Android.Locations.Location location in result.Locations) { System.Diagnostics.Debug.WriteLine(string.Format("{0} - {1}: {2},{3}", CrossGeofence.Id, "Location Update", location.Latitude, location.Longitude)); currentGeofenceImplementation.SetLastKnownLocation(location); } }