In the android projects properties make sure you select TLS 1.2
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When I use HttpClient in MauiApp. It works well in the Emulator, but not on the mobile phone, Why is that?(android) its a bug(?
private void OnCounterClicked(object sender, EventArgs e)
{
// HttpClient httpClent = CreateHttpClient();
//#if __ANDROID__
// httpClent = new HttpClient(new Xamarin.Android.Net.AndroidMessageHandler());
//#endif
HttpClient httpClent = new();
var res = httpClent.GetAsync($"https://xxxx.xxx/Image/Pochama/pocha-{count}.jpg");
//PokeImg.Source = ImageSource.FromStream(() => new MemoryStream(res.Content.ReadAsByteArrayAsync().Result));
//File.WriteAllBytes($"{count}.png", res.Content.ReadAsByteArrayAsync().Result);
//var stream1 = new MemoryStream(imageAsBytes);
//PokeImg.Source = $"pocha_{count % 88}.png";
count++;
CounterLabel.Text = $"Current count: {count}";
SemanticScreenReader.Announce(CounterLabel.Text);
}
In the android projects properties make sure you select TLS 1.2
Use in code
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
That dit it for me.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more