如何在Cognito AWS中获取当前用户的属性,如电话号码或电子邮件

时间:2018-03-31 18:32:38

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

我是Cognito AWS的新手,并将其用于移动应用程序。我想知道如何使用用户ID获取当前用户的用户名,电话号码或电子邮件ID等属性?

下面是我想要获取用户属性的代码(使用AWS教程制作)。

AWSMobileClient.getInstance().initialize(this, new AWSStartupHandler() {
public DynamoDBMapper dynamoDBMapper;

@Override
public void onComplete(AWSStartupResult awsStartupResult) {
    PinpointConfiguration pinpointConfig = new PinpointConfiguration(
            getApplicationContext(),
            AWSMobileClient.getInstance().getCredentialsProvider(),
            AWSMobileClient.getInstance().getConfiguration());
    pinpointManager = new PinpointManager(pinpointConfig);
    setContentView(R.layout.activity_question);
    // Start a session with Pinpoint
    pinpointManager.getSessionClient().resumeSession();

    AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient(AWSMobileClient.getInstance().getCredentialsProvider());
    this.dynamoDBMapper = DynamoDBMapper.builder().dynamoDBClient(dynamoDBClient).awsConfiguration(AWSMobileClient.getInstance().getConfiguration()).build();
    identityManager = new IdentityManager(getApplicationContext(), AWSMobileClient.getInstance().getConfiguration());

0 个答案:

没有答案