AWS Mobile Hub Developer Guide - Developer Guide AWS Mobile Hub Developer Guide Developer Guide Android

  • View
    0

  • Download
    0

Embed Size (px)

Text of AWS Mobile Hub Developer Guide - Developer Guide AWS Mobile Hub Developer Guide Developer Guide...

  • AWS Mobile Hub Developer Guide

    Developer Guide

    AWS Mobile Hub Developer Guide: Developer Guide Copyright © 2020 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

  • AWS Mobile Hub Developer Guide Developer Guide

    Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

  • AWS Mobile Hub Developer Guide Developer Guide

    Table of Contents Mobile and Web App Development .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Reference .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    SDK API References .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 AWS Mobile Hub Reference .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Android and iOS .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Web .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 React Native .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Mobile Hub Features .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 IAM Usage .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Project Service Region Hosting .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Troubleshooting Projects ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Exporting and Importing Projects ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 Amazon CloudFront Security ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 Amazon S3 Security ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246

    iii

  • AWS Mobile Hub Developer Guide Developer Guide

    Mobile and Web App Development The Amplify Framework enables developers to build cloud-powered mobile and web apps. It includes a comprehensive set of SDKs, libraries, tools, and documentation for client app development. Learn more or get started with the Amplify Framework now.

    1

    https://aws-amplify.github.io/ https://aws-amplify.github.io/docs

  • AWS Mobile Hub Developer Guide Developer Guide SDK API References

    AWS Mobile Reference Topics

    • Android and iOS API References (p. 2)

    • AWS Mobile Hub Reference (p. 2)

    Android and iOS API References Android

    • AWS Mobile SDK for Android API Reference

    • AWS Mobile SDK for Android on GitHub

    • AWS Mobile SDK for Android Samples

    iOS

    • AWS Mobile SDK for iOS API Reference

    • AWS Mobile SDK for iOS on GitHub

    • AWS Mobile SDK for iOS Samples

    AWS Mobile Hub Reference Topics

    • AWS Mobile for Android and iOS (p. 2)

    • AWS Amplify Library for Web (p. 141)

    • AWS Amplify Library for React Native (p. 176)

    • AWS Mobile Hub Features (p. 190)

    • AWS Identity and Access Management Usage in AWS Mobile Hub (p. 214)

    • Mobile Hub Project Service Region Hosting (p. 224)

    • Mobile Hub Project Troubleshooting (p. 229)

    • Exporting and Importing AWS Mobile Hub Projects (p. 233)

    • Amazon CloudFront Security Considerations for Mobile Hub Users (p. 245)

    • Amazon S3 Security Considerations for Mobile Hub Users (p. 246)

    AWS Mobile for Android and iOS

    The following reference content only applies to existing apps that were built using the AWS Mobile SDKs for iOS and Android. If you’re building a new mobile or web app, or you’re adding cloud

    2

    https://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/ https://github.com/aws/aws-sdk-android https://github.com/awslabs/aws-sdk-android-samples https://docs.aws.amazon.com/AWSiOSSDK/latest/ https://github.com/aws/aws-sdk-ios https://github.com/awslabs/aws-sdk-ios-samples

  • AWS Mobile Hub Developer Guide Developer Guide Android and iOS

    capabilities to an existing app, visit the Amplify Framework website instead. Documentation for the AWS Mobile SDKs for iOS and Android is now part of the Amplify Framework.

    The AWS Mobile SDKs for Android and iOS enable you to quickly and easily integrate robust cloud backends into your existing mobile apps.

    Topics • Get Started (p. 3) • AWS Mobile Android and iOS How To (p. 92)

    Get Started

    The following reference content only applies to existing apps that were built using the AWS Mobile SDKs for iOS and Android. If you’re building a new mobile or web app, or you’re adding cloud capabilities to an existing app, visit the Amplify Framework website instead. Documentation for the AWS Mobile SDKs for iOS and Android is now part of the Amplify Framework.

    Overview

    The AWS Mobile Android and iOS SDKs help you build high quality mobile apps quickly and easily. They provide easy access to a range of AWS services, including Amazon Cognito, AWS Lambda, Amazon S3, Amazon Kinesis, Amazon DynamoDB, Amazon Pinpoint and many more.

    Set Up Your Backend

    1. Sign up for the AWS Free Tier. 2. Create a Mobile Hub project by signing into the console. The Mobile Hub console provides a single

    location for managing and monitoring your app’s cloud resources. 3. Name your project, check the box to allow Mobile Hub to administer resources for you and then

    choose Add.

    Android - Java

    1. Choose Android as your platform and then choose Next.

    3

    https://amzn.to/am-amplify-docs https://amzn.to/am-amplify-docs https://aws.amazon.com/free/ https://console.aws.amazon.com/mobilehub/

  • AWS Mobile Hub Developer Guide Developer Guide Android and iOS

    2. Choose the Download Cloud Config and then choose Next.

    The awsconfiguration.json file you download contains the configuration of backend resources that Mobile Hub enabled in your project. Analytics cloud services are enabled for your app by default.

    3. Add the backend service configuration file to your app.

    In the Project Navigator, right-click your app’s res folder, and then choose New > Directory. Type raw as the directory name and then choose OK.

    From the location where configuration file, awsconfiguration.json, was downloaded in a previous step, drag it into the res/raw folder. Android gives a resource ID to any arbitrary file placed in this folder, making it easy to reference in the app.

    Remember Every time you create or update a feature in your Mobile Hub project, download and integrate a new version of your awsconfiguration.json into each app in the project that will use the update.

    Your backend is now configured. Connect the backend to your mobile app using the steps in the next section.

    4

  • AWS Mobile Hub Developer Guide Developer Guide Android and iOS

    Android - Kotlin

    1. Choose Android as your platform and then choose Next.

    2. Choose the Download Cloud Config and then choose Next.

    The awsconfiguration.json file you download contains the configuration of backend resources that Mobile Hub enabled in your project. Analytics cloud services are enabled for your app by default.

    3. Add the backend service configuration file to your app.

    In the Project Navigator, right-click your app’s res folder, and then choose New > Directory. Type raw as the directory name and then choose OK.

    5

  • AWS Mo