ruby.lee
ruby.lee

Reputation: 107

Xamarin Android call WebAPI Connection Fail

I've create an app in Xamarin, the app will call a WebAPI to login and retrieve data from server.

The WebAPI is http, not https.

The calling of web API success in iOS emulator, iOS device, and Android emulator. (I do not have android device to test).

But when deploy to user using Android phone, calling of Web API fail with error message Connection Fail.

No idea why this happen. Please guide me what I can check.

Thanks

Upvotes: 0

Views: 150

Answers (2)

ColeX
ColeX

Reputation: 14475

Check if the setting is set correctly in Properties .

HttpClient implementation -> Android

SSL/TLS implementaiton -> Native TLS 1.2+

enter image description here

Update

Add android:networkSecurityConfig="@xml/network_security_config" into AndroidManifest .

Create a new xml named network_security_config.xml , add it into res/xml folder .

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
     <base-config cleartextTrafficPermitted="true" />
</network-security-config>

Upvotes: 1

Dani
Dani

Reputation: 584

Make sure your android emulator is set up correctly and is connected to the internet

Upvotes: 0

Related Questions