“Unable to resolve host ”almsdev.southeastasia.cloudapp.azure.com“: No address associated with host

sagarsagar Member ✭✭

How to resolve “Unable to resolve host ”almsdev.southeastasia.cloudapp.azure.com“: No address associated with hostname”?
I am working on xamarin forms. Where I am consuming the API. When I am running ht e app in android 5 it is working fine but If I am running 7 + it is giving the error like Unable to resolve host "almsdev.southeastasia.cloudapp.azure.com": No address associated with hostname. How to resolve this?

Following is the code snippet
public async Task<HttpResponseMessage> Login(string EmailOrMobile) { try { var responseTask = await client.GetAsync(OauthBaseUrl + "OAuthSAAS/MSLogin?UserCredentials=" + EmailOrMobile); return responseTask; } catch (Exception ex) { Crashes.TrackError(ex); return null; } }

On button click I am calling above method
private async void fn_Submit_Clicked(object sender, EventArgs e) { var response = await _oauthService.Login(txt_credentails.Text.Trim()); }

My Base URL is
http://almsdev.southeastasia.cloudapp.azure.com:81/api/

Best Answer

  • sagarsagar ✭✭
    Accepted Answer

    Thank you reply @LeonLu, How I resolved this problem is by changing http to https.

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @sagar - Check that the DNS settings on your Android 7+ devices match the DNS settings on your Android 5 device

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    edited June 13

    Did you add these permissions in your application?Please open the AndroidManifest.xml, please check it. And If you a have given these permissions.

     <uses-permission android:name="android.permission.INTERNET" /> 
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    
  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Are there any updates for this issue? If the reply is helpful, please try to mark it as an answer, it will help others who have similar issue.

  • sagarsagar Member ✭✭
    Accepted Answer

    Thank you reply @LeonLu, How I resolved this problem is by changing http to https.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    Ok, thanks for your sharing, please mark your answer, it will help others who have similar issue.

Sign In or Register to comment.