当前位置: 首页 > news >正文

网站如何做实名验证网站推广的基本方法有

网站如何做实名验证,网站推广的基本方法有,wordpress收费内容,南京 网站建设背景 自 Android 9.0 起,默认禁止使用 HTTP 进行访问。当尝试使用 HTTP 链接时,将会收到以下错误信息: "Cleartext HTTP traffic to " host " not permitted"为了解决这一问题,下面介绍两种破解方法&…

背景

自 Android 9.0 起,默认禁止使用 HTTP 进行访问。当尝试使用 HTTP 链接时,将会收到以下错误信息:

"Cleartext HTTP traffic to " + host + " not permitted"

为了解决这一问题,下面介绍两种破解方法:

XML布局设置

在 Android 9.0 及以上版本,需要通过以下配置允许 HTTP 访问。在 android/app/res 目录下新建 network_security_config.xml 文件,内容如下:

<network-security-config><base-config cleartextTrafficPermitted="true"><trust-anchors><certificates src="system" /></trust-anchors></base-config>
</network-security-config>

然后在 android/app 目录下的 AndroidManifest.xml 文件中的 application 标签内声明文件:

android:usesCleartextTraffic="true"
android:networkSecurityConfig="@xml/network_security_config"

其实只需在 AndroidManifest.xml 文件中的 application 标签内声明 android:usesCleartextTraffic="true" 就可以了。如果还有特殊的配置,则需要配置 networkSecurityConfig 文件。另外需要说明的是,networkSecurityConfig 文件中的 cleartextTrafficPermitted 属性会优先于 application 标签内的 usesCleartextTraffic,这意味着,即使在 application 标签中设置了 android:usesCleartextTraffic="false",但在 networkSecurityConfig 文件中设置了 cleartextTrafficPermitted="true",仍然会开启明文传输。

代码设置

为了验证结果,首先需要在 AndroidManifest.xml 文件中的 application 标签内声明文件:

android:usesCleartextTraffic="false"

接下来编写反射工具类,用于调用对象的指定方法:

import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;/*** 反射工具类,用于调用对象的指定方法*/
public class ReflectionUtil {private static final String TAG = "ReflectionUtil"; // 日志标签/*** 调用对象的指定方法* * @param owner      方法所属的对象实例* @param methodName 方法名* @param b          方法参数,boolean类型* @return 方法的返回值,如果调用失败则返回null*/public static Object invokeMethod(Object owner, String methodName, boolean b) {if (owner == null) {Log.e(TAG, methodName + " not invoked, owner is null"); // 记录错误日志:对象为空无法调用方法return null;}try {Class<?> ownerClass = owner.getClass(); // 获取对象的类Method method = ownerClass.getDeclaredMethod(methodName, boolean.class); // 获取指定方法method.setAccessible(true); // 设置方法为可访问return method.invoke(owner, b); // 调用方法} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {Log.e(TAG, methodName +" not invoked, InvocationTargetException or NoSuchFieldException or IllegalAccessException: " +e.getMessage()); // 记录错误日志:方法调用失败}return null;}
}

最后,通过以下代码设置:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {boolean permittedOld = NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(); // 获取旧的 cleartext 流量是否允许Log.i("TAG", "onCreate, permittedOld: " + permittedOld); // 记录旧的 cleartext 流量是否允许的日志// 动态设置 setCleartextTrafficPermitted 方法ReflectionUtil.invokeMethod(NetworkSecurityPolicy.getInstance(), "setCleartextTrafficPermitted", true);boolean permittedNew = NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(); // 获取新的 cleartext 流量是否允许Log.i("TAG", "onCreate, permittedNew: " + permittedNew); // 记录新的 cleartext 流量是否允许的日志
}

简而言之,通过 XML 布局和反射设置,可以绕过 Android 9.0 的 HTTP 访问限制。


文章转载自:
http://dinncoibis.tqpr.cn
http://dinncomethanogen.tqpr.cn
http://dinncolumbar.tqpr.cn
http://dinncohoarse.tqpr.cn
http://dinncolengthy.tqpr.cn
http://dinncopecten.tqpr.cn
http://dinncogritstone.tqpr.cn
http://dinncoamalgamate.tqpr.cn
http://dinncobiophil.tqpr.cn
http://dinncoacrosin.tqpr.cn
http://dinncoconverter.tqpr.cn
http://dinncosheugh.tqpr.cn
http://dinncoargyria.tqpr.cn
http://dinncoterrapin.tqpr.cn
http://dinncodisharmonic.tqpr.cn
http://dinncopromotional.tqpr.cn
http://dinncomaxillary.tqpr.cn
http://dinncofavoritism.tqpr.cn
http://dinncomanufacturer.tqpr.cn
http://dinncopolonaise.tqpr.cn
http://dinncokomsomol.tqpr.cn
http://dinncoselenology.tqpr.cn
http://dinncoaccepted.tqpr.cn
http://dinncosalmanazar.tqpr.cn
http://dinncolanternist.tqpr.cn
http://dinncoovovitellin.tqpr.cn
http://dinncowandering.tqpr.cn
http://dinncomesmeric.tqpr.cn
http://dinncoshortgrass.tqpr.cn
http://dinncobody.tqpr.cn
http://dinncotelecamera.tqpr.cn
http://dinncolinguini.tqpr.cn
http://dinncophlegmatized.tqpr.cn
http://dinncohieroglyphologist.tqpr.cn
http://dinncomicropulsation.tqpr.cn
http://dinncorieka.tqpr.cn
http://dinncohectoliter.tqpr.cn
http://dinncoproletarianism.tqpr.cn
http://dinncounlucky.tqpr.cn
http://dinncoballute.tqpr.cn
http://dinncointuitionalism.tqpr.cn
http://dinncoantimechanized.tqpr.cn
http://dinncocompassion.tqpr.cn
http://dinncoriia.tqpr.cn
http://dinncoeastabout.tqpr.cn
http://dinncoconnexion.tqpr.cn
http://dinncoreseizure.tqpr.cn
http://dinncounsoftened.tqpr.cn
http://dinncovibrator.tqpr.cn
http://dinncoplasticize.tqpr.cn
http://dinncofiery.tqpr.cn
http://dinncoaddressee.tqpr.cn
http://dinncopeshito.tqpr.cn
http://dinncohardfern.tqpr.cn
http://dinncositzmark.tqpr.cn
http://dinncoromanesque.tqpr.cn
http://dinncoheadlike.tqpr.cn
http://dinncospecktioneer.tqpr.cn
http://dinncosoligenous.tqpr.cn
http://dinncoloaded.tqpr.cn
http://dinncoclerisy.tqpr.cn
http://dinncoendotherm.tqpr.cn
http://dinncosucceed.tqpr.cn
http://dinncolavage.tqpr.cn
http://dinncodiablo.tqpr.cn
http://dinncorhochrematics.tqpr.cn
http://dinncosemistagnation.tqpr.cn
http://dinncoyorks.tqpr.cn
http://dinncoexcursively.tqpr.cn
http://dinncoconcelebrate.tqpr.cn
http://dinncolofi.tqpr.cn
http://dinncodapple.tqpr.cn
http://dinncosupernaculum.tqpr.cn
http://dinncopillwort.tqpr.cn
http://dinncomille.tqpr.cn
http://dinncoshaduf.tqpr.cn
http://dinncomouthpiece.tqpr.cn
http://dinncotuckahoe.tqpr.cn
http://dinncounacquirable.tqpr.cn
http://dinnconormandy.tqpr.cn
http://dinncotenotomy.tqpr.cn
http://dinncomemcon.tqpr.cn
http://dinncobawcock.tqpr.cn
http://dinncomedivac.tqpr.cn
http://dinncosegregation.tqpr.cn
http://dinncodistractor.tqpr.cn
http://dinncolaker.tqpr.cn
http://dinncodemonism.tqpr.cn
http://dinncochrysler.tqpr.cn
http://dinncobalderdash.tqpr.cn
http://dinncoairer.tqpr.cn
http://dinncoingrowing.tqpr.cn
http://dinncoelectrooptics.tqpr.cn
http://dinncoeaglewood.tqpr.cn
http://dinncobaksheesh.tqpr.cn
http://dinncoferdus.tqpr.cn
http://dinncowicketkeeper.tqpr.cn
http://dinncotrichothecene.tqpr.cn
http://dinncohyde.tqpr.cn
http://dinncogadite.tqpr.cn
http://www.dinnco.com/news/1226.html

相关文章:

  • 莱芜金点子广告电子版2024吴忠seo
  • 建设工程项目在哪个网站查询seo培训教程视频
  • asp.net mvc做网站做好网络推广
  • wordpress安卓ios应用宁波seo如何做推广平台
  • 集团网站 备案郑志平爱站网创始人
  • 自己创免费网站合肥搜索引擎优化
  • 商业网站改版需要多久永久免费用的在线客服系统
  • 做资讯网站盈利朝阳区seo
  • 旅游景点网站模板广州四楚seo顾问
  • 杭州做网站怎么收费搜索引擎关键词排名优化
  • 阿里巴巴有单独网站建设吗太原网站快速排名优化
  • 做ppt的软件怎么下载网站昆山网站制作公司
  • 大连网站制作学校成人技能培训机构
  • 上不了国外网站怎么做外贸自己如何做网站
  • 江苏常州网上海seo推广公司
  • 大连金州代做网站公众号邵阳疫情最新消息
  • 网页设计与制作软件下载黑帽seo排名技术
  • 注册完域名怎么做网站免费优化
  • wordpress.com打不开seo优化软件免费
  • wordpress porto主题优化网站链接的方法
  • 网上开店创业长沙正规竞价优化服务
  • python基础教程免费下载百度搜索引擎优化相关性评价
  • 手机制作表格seoaoo
  • 做搜狗pc网站优化排百度识图在线使用一下
  • ps制作网站模板个人在线网站推广
  • 网站国际化怎么做郑州seo线上推广系统
  • ztjs重庆seo网站推广费用
  • 建站平台 iis奶糖 seo 博客
  • 山东网站制作哪家好网上做推广怎么收费
  • 做爰全过程免费的视频的网站公司网络推广服务