简体   繁体   中英

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.

There is a way to fix this? I'm not found any documentation about this...

Here is API from SafetyNet lib:

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

<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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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