In this tutorial, you start with a working app, driven by locally stored data, and then add cloud-enabled features as follows:
- Add analytics to your app so you can view demographic information about your users.
- Add a simple sign-in/sign-up flow for authentication.
- Access data stores in the AWS cloud, so that a user's notes are available to them on any device with the app installed.
You should be able to complete the setup section of this tutorial within 10-15 minutes after you have installed all required software. After you complete the following instructions, you can run the project on your local system.
Before you begin, do the following:
- Complete the Getting Started instructions to install the Amplify CLI.
- Download and install Android Studio version 3.0.1 or later.
- Download and install Android SDK version 8.0 (Oreo), API level 26.
- Install an Android Emulator. The app works with both phone and tablet emulators (for example, the Nexus 5X or Pixel C).
Download the source code as a ZIP file. After the download is complete, unpack the downloaded ZIP file.
To compile the source code, do the following:
-
Start Android Studio.
-
If you have a project open already, choose File > Close Project.
-
Choose Open an existing Android Studio project.
-
Find and choose the aws-mobile-android-notes-tutorial-master project in your file system, and then choose OK.
-
On the menu bar, choose File > Sync Project with Gradle Files.
-
On the menu bar, choose Build > Make Project.
The compilation step should finish with no errors. Errors are displayed in the Messages window, which is available on the status bar at the bottom of the project.
If you haven't already done so, create a new emulator as follows:
- Choose Tools > Android > AVD Manager.
- Choose Create Virtual Device....
- Choose Phone > Nexus 5X, and then choose Next.
- Choose the x86 Images tab, and then choose Android 8.0 (Google APIs).
- If you didn't previously downloaded the image, you can download it from this screen.
- Choose Next.
- Choose Finish.
- Close the AVD Manager.
Run the project in an emulator as follows:
- Choose Run > Run 'app'.
- Choose the Nexus 5X API 26 virtual device.
- Choose OK.
If it isn't already running, the Android emulator starts and then the application runs. You should be able to interact with the application as you would any other mobile app. Try pressing on the plus sign + at the of the app to create a note, or choose a note to show in the editor screen. A unique ID for each note is displayed in the list view underneath the note's title.
The most common problems at this stage involve issues with the installation of Java, Android Studio, the Android SDK, or the Android Emulator. Google provides detailed instructions about Android Studio and dependent features.
Next, integrate application analytics into your project.