Ejemplo n.º 1
0
        private async void OnClickGetLocationWithHD(object sender, EventArgs eventArgs)
        {
            string Tag = "GetLocationWithHD";

            LocationRequest request = new LocationRequest();

            SetLocationRequest(request);

            locationHDCallback = new LocationHDCallback();
            var task = fusedLocationProviderClient.RequestLocationUpdatesExAsync(request, locationHDCallback, Looper.MainLooper);

            try
            {
                await task;
                if (task.IsCompleted)
                {
                    log.Info(Tag, "RequestLocationUpdatesEx with callback succeeded.");
                }
                else
                {
                    log.Error(Tag, $"RequestLocationUpdatesEx with callback failed: {task.Exception.Message}");
                }
            }
            catch (Exception e)
            {
                log.Error(Tag, $"RequestLocationUpdatesEx with callback failed: {e.Message}");
            }
        }