android - Android reCaptcha 强制纵向定向
问题描述
我正在开发一个需要使用 reCaptcha 验证用户的 Android 应用程序,但我遇到了奇怪的行为:如果屏幕方向为横向,则点击触发 reCaptcha API 方向的按钮将变为纵向,然后再返回横向。
有办法解决这个问题吗?我没有找到任何有关此的文档...
这是来自 SafetyNet 库的 API:
SafetyNet.getClient(this).verifyWithRecaptcha(ReCaptcha.RECAPTCHA_APP_KEY)
版本:
implementation("com.google.android.gms:play-services-safetynet:17.0.0")
解决方案
当您旋转时,您的活动会刷新
您需要在活动标签中声明 android:configChanges="orientation|screenSize"
<activity
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
这将避免活动刷新我希望这会有所帮助
推荐阅读
- python - stripe.error.InvalidRequestError:无法确定要请求的 URL:客户实例的 ID 无效:
- r - 如何对变量进行分组,以便从中计算中位数?
- c - 使用 C 套接字创建服务器并出现错误
- python - Pandas 自定义 Groupby 占总数的百分比
- python - Numpy数组:每行的乘法数组
- r - R - 按顺序排列数据框,如果变量保持不变则重复值,并在它改变时改变它
- html - 卡在媒体查询中,我无法修复它
- r - 在嵌套函数中使用相同的参数名称会导致意外输出
- cygwin - 如何删除cygwin挂载点
- python - 沿轴使用给定索引对多维 np.array 进行排序