Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

SDK Setup Options

The AWS SDK contains high-level client interfaces for quickly adding common features and functionality to your app. You can also manually add the generated AWS service interfaces for direct interaction if you have custom or advanced requirements.

Android Gradle setup

The AWS Mobile SDK for Android is available through Gradle.

If you are using Android Studio, add the dependency for the individual services that your project will use to your app/build.gradle file, as shown below.

dependencies {
implementation 'com.amazonaws:aws-android-sdk-ddb:ANDROID_SDK_VERSION'
}

A full list of dependencies are listed below. For dependencies ending in "@aar" use a compile statement in the following form.

implementation 'com.amazonaws:aws-android-sdk-mobile-client:ANDROID_SDK_VERSION'
DependencyBuild.gradle Value
"Amazon API Gateway""com.amazonaws:aws-android-sdk-apigateway-cor:ANDROID_SDK_VERSION"
"AWS Auth Core""com.amazonaws:aws-android-sdk-auth-core:ANDROID_SDK_VERSION"
"AWS Facebook SignIn Provider""com.amazonaws:aws-android-sdk-auth-facebook:ANDROID_SDK_VERSION"
"AWS Google SignIn Provider""com.amazonaws:aws-android-sdk-auth-google:ANDROID_SDK_VERSION"
"AWS Auth UI""com.amazonaws:aws-android-sdk-auth-ui:ANDROID_SDK_VERSION"
"AWS Cognito User Pools SignIn Provider""com.amazonaws:aws-android-sdk-auth-userpools:ANDROID_SDK_VERSION"
"Amazon Auto Scaling""com.amazonaws:aws-android-sdk-autoscaling:ANDROID_SDK_VERSION"
"Amazon CloudWatch""com.amazonaws:aws-android-sdk-cloudwatch:ANDROID_SDK_VERSION"
"Amazon Cognito Auth""com.amazonaws:aws-android-sdk-cognitoauth:ANDROID_SDK_VERSION"
"Amazon Cognito Identity Provider""com.amazonaws:aws-android-sdk-cognitoidentityprovider:ANDROID_SDK_VERSION"
"AWS Core""com.amazonaws:aws-android-sdk-core:ANDROID_SDK_VERSION"
"Amazon DynamoDB Document Model""com.amazonaws:aws-android-sdk-ddb-document:ANDROID_SDK_VERSION"
"Amazon DynamoDB Object Mapper""com.amazonaws:aws-android-sdk-ddb-mapper:ANDROID_SDK_VERSION"
"Amazon DynamoDB""com.amazonaws:aws-android-sdk-ddb:ANDROID_SDK_VERSION"
"Amazon Elastic Compute Cloud""com.amazonaws:aws-android-sdk-ecANDROID_SDK_VERSION"
"Amazon Elastic Load Balancing""com.amazonaws:aws-android-sdk-elb:ANDROID_SDK_VERSION"
"AWS IoT""com.amazonaws:aws-android-sdk-iot:ANDROID_SDK_VERSION"
"Amazon Kinesis""com.amazonaws:aws-android-sdk-kinesis:ANDROID_SDK_VERSION"
"Amazon Kinesis Video""com.amazonaws:aws-android-sdk-kinesisvideo:ANDROID_SDK_VERSION"
"Amazon Key Management Service (KMS)""com.amazonaws:aws-android-sdk-kms:ANDROID_SDK_VERSION"
"AWS Lambda""com.amazonaws:aws-android-sdk-lambda:ANDROID_SDK_VERSION"
"Amazon Lex""com.amazonaws:aws-android-sdk-lex:ANDROID_SDK_VERSION"
"Amazon CloudWatch Logs""com.amazonaws:aws-android-sdk-logs:ANDROID_SDK_VERSION"
"Amazon Machine Learning""com.amazonaws:aws-android-sdk-machinelearning:ANDROID_SDK_VERSION"
"AWS Mobile Client""com.amazonaws:aws-android-sdk-mobile-client:ANDROID_SDK_VERSION"
"Amazon Pinpoint""com.amazonaws:aws-android-sdk-pinpoint:ANDROID_SDK_VERSION"
"Amazon Polly""com.amazonaws:aws-android-sdk-polly:ANDROID_SDK_VERSION"
"Amazon Rekognition""com.amazonaws:aws-android-sdk-rekognition:ANDROID_SDK_VERSION"
"Amazon Simple Storage Service (S3)""com.amazonaws:aws-android-sdk-s3:ANDROID_SDK_VERSION"
"Amazon Simple DB (SDB)""com.amazonaws:aws-android-sdk-sdb:ANDROID_SDK_VERSION"
"Amazon SES""com.amazonaws:aws-android-sdk-ses:ANDROID_SDK_VERSION"
"Amazon SNS""com.amazonaws:aws-android-sdk-sns:ANDROID_SDK_VERSION"
"Amazon SQS""com.amazonaws:aws-android-sdk-sqs:ANDROID_SDK_VERSION"

Whenever a new version of the SDK is released you can update by running a Gradle Sync and rebuilding your project to use the new features.

AWS SDK Version vs. Semantic Versioning

The AWS SDK for Android does not follow semantic versioning. Instead, it increments the patch-level version for both backward-compatible bug fixes and non-breaking changes, and increments the minor version for breaking changes. Major version changes are rare, and usually indicate a dramatically different programming model.

For comparison, Semantic versioning increments the patch level for backward-compatible bug fixes, the minor version for backward-compatible new features, and the major version for breaking changes.

Set Permissions in Your Manifest

Add the following permission to your AndroidManifest.xml::

<uses-permission android:name="android.permission.INTERNET" />

Direct AWS Service access

You can call AWS service interface objects directly via the generated SDK clients. You can use the client credentials provided by the AWSMobileClient by calling AWSMobileClient.getInstance() and passing it to the service client. This will leverage short term AWS credentials from Cognito Identity.

To work with service interface objects, your Amazon Cognito users' IAM role must have the appropriate permissions to call the requested services.

For example, if you were using Amazon Simple Queue Service (SQS) in your Android project you would first add aws-android-sdk-sqs:ANDROID_SDK_VERSION to your app/build.gradle and install the dependencies by running a Gradle Sync.

Next, import AmazonSQS in your Android Studio project and create the client:

import com.amazonaws.services.sqs.AmazonSQSAsyncClient;
import com.amazonaws.services.sqs.model.SendMessageRequest;
import com.amazonaws.services.sqs.model.SendMessageResult;
public void addItemSQS() {
AmazonSQSAsyncClient sqs = new AmazonSQSAsyncClient(AWSMobileClient.getInstance());
sqs.setRegion(Region.getRegion("XX-XXXX-X"));
SendMessageRequest req = new SendMessageRequest("https://sqs.XX-XXXX-X.amazonaws.com/XXXXXXXXXXXX/MyQueue", "hello world");
sqs.sendMessageAsync(req, new AsyncHandler<SendMessageRequest, SendMessageResult>() {
@Override
public void onSuccess(SendMessageRequest request, SendMessageResult sendMessageResult) {
Log.i(LOG_TAG, "SQS result: " + sendMessageResult.getMessageId());
}
@Override
public void onError(Exception e) {
Log.e(LOG_TAG, "SQS error: ", e);
}
});
}

You could then call this.addItemSQS() to invoke this action from your app.