AWS Mobile Hub-如何获取用户名

时间:2018-06-29 12:35:47

标签: amazon-web-services aws-cognito aws-mobilehub

我已经使用AWS移动中心创建了一个示例Android应用程序。遵循开发人员指南(https://docs.aws.amazon.com/aws-mobile/latest/developerguide/getting-started.html)并使用Amazon Cognito将用户登录添加到移动应用。

创建了一个用户并成功登录。登录后,我想找到我登录时使用的用户名。这些详细信息将发送到数据库,以记录有多少用户登录。 / p>

任何人都可以建议我如何获取用户名

1 个答案:

答案 0 :(得分:0)

问题已解决。我已使用以下代码获取用户名:
CognitoUserPool userpool = new CognitoUserPool(AuthenticatorActivity.this, new AWSConfiguration(AuthenticatorActivity.this)); String str = userpool.getCurrentUser().getUserId();

相关问题