android - 如何使用android :usesCleartextTraffic below Marshmallow (API-23)

标签 android android-webview android-manifest

我正在尝试保护 WebView 免受明文流量的影响。如文档中所述。我必须将 android:usesCleartextTraffic 设置为 false 才能实现此目的。但这适用于 API 级别 23 及更高级别。我的最低 sdk 是 22。如何确保应用程序不会崩溃或在运行低于 API 级别 23 的设备上产生任何问题?或者我如何以编程方式在 Manifest.xmlapplication 标记中设置该属性值?

最佳答案

an article 中的建议@Android 开发者博客:

You don’t have to set minSdkVersion or targetSdkVersion of your app to 23 (Android Marshmallow) to use android:usesCleartextTraffic. On older platforms, this attribute is simply ignored and thus has no effect.

希望这能解决您的问题。

关于android - 如何使用android :usesCleartextTraffic below Marshmallow (API-23),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48555256/

相关文章:

Android 波纹背景颜色

android - 如何使用 fragment 在 Web View 中向后导航?

android - 在 Android 上使用 PhoneGap 处理无互联网连接的情况

android - 强制方形应用程序图标

javascript - React-Native 如何查看导入文件的变化?

android - 设置壁纸时应用程序崩溃

Android - Webviewclient onReceivedHttpError 确定是否是主要资源

AndroidManifest 每个版本?

java - 自动启动安卓服务

android - 如何避免在activity.recreate()期间黑屏