从Android9.0系统开始,应用程序默认只允许使用 HTTPS 类型的网络请求,HTTP类型的网络请求因为有安全隐患默认不再被支持。 那么我们为了让程序使用HTTP,我们要进行如下配置:右击res目录–>New–>Directory,创建一个xml目录,接着右击xml目录–>New–>File,创建一个network_config.xml文件。然后修改network_config.xml文件内容如下所示: 这段代码的意思就是允许我们以明文的方式在网络上传输数据,而HTTP 接下来我们修改AndroidManifest.xml中的代码来启动我们刚才创建的配置文件: 这样我们就可以在我们的项目中使用HTTP了。Android9.0明文网络传输适配
Android9.0配置网络
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <base-config cleartextTrafficPermitted="true"> <trust-anchors> <certificates src="system" /> </trust-anchors> </base-config> </network-security-config>
使用的就是明文传输方式。<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="https://schemas.android.com/apk/res/android" package="cn.hujw.networktest"> ... <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:networkSecurityConfig="@xml/network_config"> ... </application> </manifest>
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算