简体   繁体   English

Android reCaptcha 强制纵向定向

[英]Android reCaptcha forces orientation in portrait

I'm developing an Android app that needs to validate user with reCaptcha and I'm occurred on strange behaviour: if screen orientation is in landscape, tapping button that fires reCaptcha API orientation changhes to portrait and then back to landscape.我正在开发一个 Android 应用程序,该应用程序需要使用 reCaptcha 验证用户,并且我发生了奇怪的行为:如果屏幕方向为横向,点击按钮触发 reCaptcha API 方向更改为纵向,然后返回横向。

There is a way to fix this?有办法解决这个问题吗? I'm not found any documentation about this...我没有找到任何有关此的文档...

Here is API from SafetyNet lib:这是来自 SafetyNet 库的 API:

SafetyNet.getClient(this).verifyWithRecaptcha(ReCaptcha.RECAPTCHA_APP_KEY) 

Version:版本:

 implementation("com.google.android.gms:play-services-safetynet:17.0.0")

When you rotate your activity gets refreshed当您旋转时,您的活动会刷新

You need to declare android:configChanges="orientation|screenSize" in activity tag您需要在活动标签中声明 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>

this will avoid activity refresh I hope this will help这将避免活动刷新我希望这会有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM