Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Call Web Service Google API does not work

$
0
0

Hello,

I have currently a strange problem when I try accessing google api with HttpClient.

Here the code :

public async Task<string> AutoCompletionGooglePlace(string _input)
        {
            string path = GoogleApi.Instance.googleApiUri + "place/autocomplete/json?input=" + _input + "&types=geocode&language=fr&key=" + GoogleApi.Instance.Key;

            using (var client = new HttpClient())
            {
                //string test = JsonConvert.SerializeObject(_apiToCall);
                HttpResponseMessage response = await client.GetAsync(new Uri(path));

                if (response.IsSuccessStatusCode)
                {
                    var stringContent = await response.Content.ReadAsStringAsync();
                    return stringContent;

                }

                return null;


            }
        }

When I use GetAsync, Android System ask to wait because application isn't responding.
I can wait the time as I want, I don't receive any response.

Somebody have an Idea ?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>