在AWS Cognito上向Android移动SDK注册新用户

在AWS Cognito上向Android移动SDK注册新用户,android,amazon-cognito,Android,Amazon Cognito,我正试图在安卓系统中为AWS Cognito开发一个新版本。我刚刚检查了,但是在registeranewuser部分中只有使用SignUpHandler的示例 检查其他部分,例如,使用 userPool.signUp('username','password',attributeList,null,function(err,result) 我正试图实现这个转换javascript示例的方法,但我想知道是否有完整的Android注册示例 提前感谢!!您注意到的处理程序是注册调用的一个参数,很像J

我正试图在安卓系统中为AWS Cognito开发一个新版本。我刚刚检查了,但是在registeranewuser部分中只有使用
SignUpHandler
的示例

检查其他部分,例如,使用
userPool.signUp('username','password',attributeList,null,function(err,result)

我正试图实现这个转换javascript示例的方法,但我想知道是否有完整的Android注册示例


提前感谢!!

您注意到的处理程序是注册调用的一个参数,很像JS示例中的“函数”(err,result)。请看,它显示了如何使用该处理程序。从您截屏的示例中,它可能如下所示:

userPool.signUpInBackground(userId, password, userAttributes, null, handler);

您注意到的处理程序是注册调用的一个参数,很像JS示例中的“函数(err,result)”。请看,它显示了如何使用该处理程序。从您截屏的示例中,它可能如下所示:

userPool.signUpInBackground(userId, password, userAttributes, null, handler);

以下是使用Jeff建议的完整示例:

    CognitoUserAttributes attributes = new CognitoUserAttributes();
    attributes.addAttribute("phone_number","+15555555555");
    attributes.addAttribute("email","email@mydomain.com");

    cognitoUserPool.signUp('username', 'password', attributes, null, new SignUpHandler() {
        @Override
        public void onSuccess(CognitoUser cognitoUser, boolean b, CognitoUserCodeDeliveryDetails cognitoUserCodeDeliveryDetails) {
            // If the sign up was successful, "user" is a CognitoUser object of the user who was signed up.
            // "codeDeliveryDetails" will contain details about where the confirmation codes will be delivered.
        }

        @Override
        public void onFailure(Exception e) {
            // Sign up failed, code check the exception for cause and perform remedial actions.
        }
    });
在Android移动SDK中使用用户池的示例似乎已经过时


希望能帮助其他人;)

以下是使用Jeff建议的完整示例:

    CognitoUserAttributes attributes = new CognitoUserAttributes();
    attributes.addAttribute("phone_number","+15555555555");
    attributes.addAttribute("email","email@mydomain.com");

    cognitoUserPool.signUp('username', 'password', attributes, null, new SignUpHandler() {
        @Override
        public void onSuccess(CognitoUser cognitoUser, boolean b, CognitoUserCodeDeliveryDetails cognitoUserCodeDeliveryDetails) {
            // If the sign up was successful, "user" is a CognitoUser object of the user who was signed up.
            // "codeDeliveryDetails" will contain details about where the confirmation codes will be delivered.
        }

        @Override
        public void onFailure(Exception e) {
            // Sign up failed, code check the exception for cause and perform remedial actions.
        }
    });
在Android移动SDK中使用用户池的示例似乎已经过时


希望能帮助别人;)

嗨,杰夫,谢谢你的回答。示例位于步骤3:为应用程序注册用户。嗨,杰夫,谢谢你的回答。示例位于步骤3:为应用程序注册用户。