protected override void OnHandleIntent(Intent intent)
        {
            if (intent == null)
            {
                return;
            }

            MvxTrace.TaggedTrace(TAG, "GeofenceTransitionsIntentService handle intent");

            var geofencingEvent = GeofencingEvent.FromIntent(intent);

            if (geofencingEvent.HasError)
            {
                var errorMessage = GeofenceErrorMessages.GetErrorString(this, geofencingEvent.ErrorCode);
                MvxTrace.TaggedError(TAG, errorMessage);
                return;
            }

            int geofenceTransition = geofencingEvent.GeofenceTransition;

            if (geofenceTransition != Geofence.NeverExpire)
            {
                IList <IGeofence> triggeringGeofences = geofencingEvent.TriggeringGeofences;

                var geofencesIds = GetGeofenceTransitionDetails(this, geofenceTransition, triggeringGeofences);
                LoadOffersInGeofences(geofencesIds);
            }
            else
            {
                // Log the error.
                MvxTrace.TaggedError(TAG, GetString(Resource.String.geofence_transition_invalid_type, new[] { new Java.Lang.Integer(geofenceTransition) }));
            }
        }
 private void HandleResult(Statuses status, string message)
 {
     if (status.IsSuccess)
     {
         MvxTrace.TaggedTrace(TAG, message);
     }
     else
     {
         var errorMessage = GeofenceErrorMessages.GetErrorString(Application.Context, status.StatusCode);
         MvxTrace.TaggedError(TAG, errorMessage);
     }
 }
        private async void LoadOffersInGeofences(string[] geofencesIds)
        {
            if (geofencesIds == null || !geofencesIds.Any())
            {
                MvxTrace.TaggedError(TAG, string.Format("geofencesIds is null or empty"));
                return;
            }

            try
            {
                foreach (var id in geofencesIds)
                {
                    await AreaService.Instance.ActivateRegionBy(id);
                }

                MvxTrace.TaggedTrace(TAG, string.Format("Regions activated"));
            }
            catch (Exception ex)
            {
                MvxTrace.TaggedError(TAG, ex.BuildAllMessagesAndStackTrace());
            }
        }
        private async void UpdateRegions(global::Android.Locations.Location location)
        {
            if (_googleApiClient == null || !_googleApiClient.IsConnected)
            {
                return;
            }

            try
            {
                _regionsModels = await AreaService.Instance.LoadAreasByUserLocation(location.Latitude, location.Longitude);

                PopulateGeofenceList();

                RemoveGeofencesHandler();
                AddGeofencesHandler();

                MvxTrace.TaggedTrace(TAG, string.Format("Regions loaded {0}", _regionsModels.Count));
            }
            catch (System.Exception ex)
            {
                MvxTrace.TaggedError(TAG, string.Format("Error when update regions {0}", ex.InnerException?.Message));
            }
        }
 private void LogSecurityException(SecurityException securityException)
 {
     MvxTrace.TaggedError(TAG, "Invalid location permission. " +
                          "You need to use ACCESS_FINE_LOCATION with geofences", securityException);
 }