如何为少于24个API添加Android Network Security Config [英] How to add Android Network Security Config for API less than 24

查看:605
本文介绍了如何为少于24个API添加Android Network Security Config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Facebook受众网络指出.

在Audience Network Android SDK中,我们使用127.0.0.1(localhost)作为缓存代理,以在SDK中缓存媒体文件.从Android P开始,默认情况下将阻止明文流量(未加密的HTTP),这将影响SDK的媒体缓存功能,并可能影响用户体验和广告收入.

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.

现在,如果我尝试在我的AndroidManifest中添加此行android:networkSecurityConfig="@xml/network_security_config",我将收到警告,因为我的应用程序支持 minSdkVersion 15 ,API 24和更高版本中使用了属性networkSecurityConfig.

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 .

我应该如何添加android:networkSecurityConfig,这样它对API的影响不会小于24

How should I add the android:networkSecurityConfig so that it won't be impacting API less than 24

推荐答案

默认情况下,该方法起作用.较旧的设备将无法识别android:networkSecurityConfig,因为它在API级别24(Android 7.0)之前不存在.

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).

这篇关于如何为少于24个API添加Android Network Security Config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆