Amazon Cognito
Developer Guide

Using the Mobile SDK for Android

In this section, you will learn about using the Mobile SDK for Android to use Amazon Cognito user pools in your apps. This SDK provides APIs to register (sign up), confirm, and authenticate users, and more.

Key Concepts

Executing in the Current Thread or a Background Thread

All APIs that perform network calls to interact with the Amazon Cognito Identity Provider service have two methods. One of these methods executes the task and the network operations in the current thread (e.g., signUp()) and the other method (postfixed with InBackground, e.g., signUpInBackground()), executes the task in a background thread but invokes the callback methods in the thread where the InBackground method was invoked.


The Mobile SDK for Android caches the last successfully authenticated user and the user's tokens locally on the device, in SharedPreferences. The SDK also provides methods to get the last successfully authenticated user.

App Id and App Secret

The App ID (also called Client ID) and App Secret (also called Client Secret) are generated at the Amazon Cognito User Pools console. App Id is necessary to use the Mobile SDK for Android. The App Secret is optional. However, if an App Id has an associated App Secret, then you must use the App Id and App Secret in the SDK.

Main Classes


Represents an abstraction of a user pool. Provides methods to register a new user and create a new instance CognitoUser for a user belonging to this pool.


Represents a single user in a user pool. Through this class you can perform all possible operations on a user, including authentication (Sign-In), managing user attributes and settings, and much more. You can create an instance of this class from the CognitoUserPool object.


Encapsulates the tokens issued by Amazon Cognito (ID , access, and refresh token) and provides methods to read ID and access tokens.


Encapsulates CognitoUserAttributes and CognitoUserSettings.


Encapsulates all user attributes and provides methods to read and write attributes. For more information about attributes, see Configuring User Pool Attributes


Encapsulates all user settings and provides methods to read and write attributes.

On this page: