为什么 Android Digits 在号码验证后并不总是返回 onSuccess 或 onFalure?它只是完成 DigitsActivity 并且什么也不做,但有时它还可以,我收到 onSuccess。
public void initForm(){
Digits.getSessionManager().clearActiveSession();// http://stackoverflow.com/questions/31679089/fabric-digits-returns-a-null-object-of-phonenumber-after-otp-verification-on-and
DigitsAuthConfig.Builder digitsAuthConfigBuilder = new DigitsAuthConfig.Builder()
.withAuthCallBack(new AuthCallback() {
@Override
public void success(DigitsSession digitsSession, String s) {
Toast.makeText(LoginActivity.this, s, Toast.LENGTH_LONG).show();
TwitterAuthToken token = (TwitterAuthToken)digitsSession.getAuthToken();
DigitsOAuthSigning oauthSigning = new DigitsOAuthSigning(SapronApplication.conf(), token);
Map<String, String> authHeaders = oauthSigning.getOAuthEchoHeadersForVerifyCredentials();
requestToken(authHeaders.get("X-Verify-Credentials-Authorization"));
}
@Override
public void failure(DigitsException e) {
Toast.makeText(LoginActivity.this, e.toString(), Toast.LENGTH_LONG).show();
}
})
.withPhoneNumber("+7");
Digits.authenticate(digitsAuthConfigBuilder.build());
}