1

I know this question is asket a lot of times. I'm using Api 28. I added this code in AndroidManifest.xml:

<application android:networkSecurityConfig="@xml/network_security_config"></application>

In xml/network_security_config.xml

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">mypage.com</domain>
    </domain-config>
</network-security-config>

Also tested on older API(Api 22) working, i get data from hosted Api(HTTP). Any other suggestions?

Rajzer
  • 1,174
  • 11
  • 24

1 Answers1

4

If you are using API 28+ please refer to this document.

You will see that since API 28 the value android:usesCleartextTraffic now defaults to false.

In your android manifest remove the xml you have previously written and simply use:

 <?xml version="1.0" encoding="utf-8"?>
    <manifest ...>
        <application
            android:usesCleartextTraffic="true"
            ...>
            ...
        </application>
    </manifest>
    ...
James Mallon
  • 1,107
  • 9
  • 25