【问题标题】:Android reCaptcha forces orientation in portraitAndroid reCaptcha 强制纵向方向
【发布时间】:2019-10-03 16:37:18
【问题描述】:

我正在开发一个需要使用 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 recaptcha safetynet


    【解决方案1】:

    当您旋转时,您的活动会刷新

    你需要在activity标签中声明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>
    

    这将避免活动刷新 我希望这会有所帮助

    【讨论】:

    • 原来我不是在旋转屏幕,是 reCaptcha 自动强制这种行为!
    猜你喜欢
    • 2015-12-30
    • 2020-05-11
    • 1970-01-01
    • 2013-09-28
    • 2020-10-24
    • 1970-01-01
    • 1970-01-01
    • 2012-03-26
    • 1970-01-01
    相关资源
    最近更新 更多