Using Retrofit2 to perform network requests, and now trying to call a service which is in a configurable IP dress, but I get CLEARTEXT communication to **IP_ADDRESS*** not permitted by network security policy
.
I have read in forums that we can add the IP address to network_security_config.xml
, but I need address to be dynamically. Also tried to add in manifest the flag usesCleartextTraffic
but same error raises (tested on Android 10)
How can I request a dynamic IP address without having to specify it in network_security_config.xml
?
use below xml code for network_security_config.xml
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
its should work! im sorry for my weak english