Hi. I have tried to call post request by HttpClient and got exception ""Couldn't resolve host name"" This happens only on real device on emulator all is ok.
I write for tizen os at first time and don't know what could be happened.
Privileges were added.
Tizen version "4.0"; Device "Galaxy Watch SM-R810"
HttpClient httpClient = new HttpClient();
string data = null;
try
{
httpClient.DefaultRequestHeaders
.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/json"));
httpClient.Timeout = new TimeSpan(0, 1, 0);
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "RequsetUrl");
var requestContent = new StringContent(content,
Encoding.UTF8,
"application/json");//CONTEN
var result = await httpClient.PostAsync(url, requestContent);
data = await result.Content.ReadAsStringAsync();
Console.WriteLine("\n\n GetDataFromWeb() Exception Caught!");
}
catch (HttpRequestException ex)
{
Console.WriteLine("\n\n GetDataFromWeb() Exception Caught!");
Console.WriteLine("Message: {0}, StackTrace: {1}, InnerException: {2}", ex.Message, ex.StackTrace, ex.InnerException.Message);
}
return data;