In the Audience Network Android SDK, we use
127.0.0.1 (localhost) as a caching proxy to cache media files in the SDK. Since Android P, cleartext traffic (unencrypted HTTP) will be blocked by default, which will affect the functionality of media caching of the SDK and could affect user experience and ads revenue.
In order to mitigate that, you can add white list clear text traffic to the address of
127.0.0.1 which is the local address of the device itself.
You can do this using the Android network security configuration.
In case you are already using custom network security configuration to opt out from cleartext traffic, make sure to add
127.0.0.1 as a permitted domain.
The Network Security Configuration feature uses an XML file where you specify the settings for your app. If you haven't done so, under the
xml folder of the app resources, you can create a new XML file:
Then in your application manifest
AndroidManifest.xml, add the configuration to your application attribute as follows:
<?xml version="1.0" encoding="utf-8"?> <manifest ... > <application android:networkSecurityConfig="@xml/network_security_config" ... > ... </application> </manifest>
res/xml/network_security_config.xml file, you can add
localhost to the permitted cleartext traffic domain by adding:
<?xml version="1.0" encoding="utf-8"?> <network-security-config> ... <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">127.0.0.1</domain> </domain-config> ... </network-security-config>
After you have done this, the caching in the Audience Network SDK should function correctly.