简体   繁体   English

验证email活动不刷新

[英]Verification email activity not refreshing

I have an activity where I want the user to wait until email account is verified, but it is not taking the user to mainActivity once account is verified, how should I address this?我有一个活动,我希望用户等到 email 帐户被验证,但一旦帐户被验证,它不会将用户带到 mainActivity,我应该如何解决这个问题?

See my code below;请参阅下面的代码;

    user.sendEmailVerification();

    final Handler handler = new Handler();
    final int delay = 10000; //milliseconds

    handler.postDelayed(new Runnable() {
        public void run() {

            if (user.isEmailVerified()) {
                startActivity(new Intent(VerificationEmailActivity.this, MainActivity.class));
                Toast.makeText(VerificationEmailActivity.this, R.string.spend_wisely, Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(VerificationEmailActivity.this, "Check your email!", Toast.LENGTH_SHORT).show();
            }
            handler.postDelayed(this, delay);
        }
    }, delay);

}

Since the actual verification of the user happens outside of your Android app (in your browser), the app is not aware that it happens.由于用户的实际验证发生在您的 Android 应用程序之外(在您的浏览器中),因此该应用程序不知道它发生了。 This means that the app only detects the user's updated state once it auto-refreshes the token, which can take up to an hour.这意味着该应用程序仅在自动刷新令牌后才检测到用户更新的 state,这最多可能需要一个小时。

To detect it earlier, you can reload the profile by calling reload() , or forcing the refresh of the ID token by calling getIdToken(true) .要及早检测到它,您可以通过调用reload()重新加载配置文件,或通过调用getIdToken(true)强制刷新 ID 令牌。

This has been covered quite a few times already, so also check out:这已经被覆盖了很多次,所以也看看:

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

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