Facebook Audience Network states that.
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.
Now if I try to add this line android:networkSecurityConfig="@xml/network_security_config"
in my AndroidManifest
I am getting warning that attribute networkSecurityConfig is used in API 24 and higher as my app supports minSdkVersion 15 .
How should I add the android:networkSecurityConfig
so that it won't be impacting API less than 24
The Network Security Configuration is available on Android 7.0 (API level 24) and higher. Create a new xml resource file with the name network_security_config.xml. In the Android Project Panel on the left hand side, right click on res, then select New > Android resource file. Set the following options and click OK.
The default configuration for apps targeting Android 7.0 (API level 24) to Android 8.1 (API level 27) is as follows: The default configuration for apps targeting Android 6.0 (API level 23) and lower is as follows: ... Configuration used for connections to specific destinations, as defined by the domain elements.
@ZayidMohammed: API Level 15-23 will ignore android:networkSecurityConfig, since that did not exist when those versions of Android were released.
Debug app network connections Another option offered in Android Network Security Configuration is debug-overrides. This feature allows you to have settings in the Network Security Config that will only be usable when android:debuggable is set to true.
It works that way by default. Older devices will not recognize android:networkSecurityConfig
, since it did not exist prior to API Level 24 (Android 7.0).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With