By default android does not allow insecure traffic (http). You will need to update the manifest to allow http (usesCleartextTraffic)
or switch to https. See docs for installing certificate.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
i have blazor hybrid maui app i have separate project for api and calling api from hybrid maui app its working fine on window machine but when i run it on android emulator its not working
i run api on http and then try to call its not wokring
here is the method of calling api
public async Task<string> Login(LoginModel loginModel)
{
string ReturnStr = string.Empty;
using(HttpClient client = new HttpClient())
{
BaseUrl = DeviceInfo.Platform == DevicePlatform.Android ? "http://10.0.2.2:5000" : "http://localhost:5000";
var url = $"{BaseUrl}{ApiUrl.login}";
var serializedobj=JsonConvert.SerializeObject(loginModel);
var response=await client.PostAsync(url, new StringContent(serializedobj, Encoding.UTF8, "application/json"));
if (response.IsSuccessStatusCode)
{
ReturnStr=await response.Content.ReadAsStringAsync();
}
}
return ReturnStr;
}
By default android does not allow insecure traffic (http). You will need to update the manifest to allow http (usesCleartextTraffic)
or switch to https. See docs for installing certificate.
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