Forum Xamarin.Android

Post-Request of Xamarin App is not working on newer Samsung Smartphones

I don't know if this is a Xamarin problem but maybe you can help me anyway.

on newer Samsung Smartphones like the Galaxy S9, S9+, S10, s10+ or google Pixel my post request to login fails. The weird thing is it only fails when im not connected to the Wifi. It seems like something blocks the Request from getting sent. When I debug my App it says "one or more errors occured trying to send the Request" It does work on my Galaxy A8 (Android 9) or Galaxy S7 (Android 8)

My HttpCLient:

private HttpClient LoginClient()
{
var httpClient = new HttpClient()
{
BaseAddress = new Uri("https://(my uri)")
};
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
return httpClient;
}

The Request:

HttpResponseMessage httpResponse;
try
{
httpResponse = client.PostAsync("Token", content).Result;
}
catch (Exception ex)
{
var WebEx = ex.InnerException.InnerException as WebException;
if (WebEx.Status == WebExceptionStatus.NameResolutionFailure)
{
throw new Exception("Die Web-API ist nicht unter sollevaapi.ctl.de erreichbar!", ex);
}
throw;
}

Answers

  • KaiCTLKaiCTL Member
    edited September 2019

    Update: It only doesnt work with "Telekom" as mobile data provider. How is this possible?

Sign In or Register to comment.