CLEARTEXT communication to localhost not permitted by network security policy code example

Example 1: android manifest cleartext traffic permitted

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

Example 2: CLEARTEXT communication to 13.232.95.6 not permitted by network security policy

in manifest file add this ====>

<application>
android:usesCleartextTraffic="true"
</application>

Example 3: cleartraffic to true

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        ...
        android:usesCleartextTraffic="true"
        ...>
        ...
    </application>
</manifest>

Tags:

Java Example