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

Page updated Feb 21, 2024

To-do app

This is a simple to-do app that allows users to add and remove items in a to-do list. Find the source code of To-do app on our GitHub repository.

Run to-do app locally

  1. Follow the steps in Amplify Android Getting Started Tutorial to sign up for an AWS account, install and configure Amplify CLI. Install all the prerequisites for setting up a fullstack project.

  2. Open Terminal and clone the project under your preferred directory using the following command:

    git clone https://github.com/aws-amplify/amplify-android-samples.git

    Change directory to root folder of whichever language you want to use.

cd amplify-android-samples/getting-started/todo/java
cd amplify-android-samples/getting-started/todo/kotlin
  1. Follow the instructions to generate model files.

  2. Connect the project to the cloud by running the command:

    amplify push

    Answer No to ? Do you want to generate code for your newly created GraphQL API. Answering Yes will generate an API.java file which is only necessary when directly using the AWS AppSync SDK. When you're using Amplify API or Amplify DataStore, you'll use the amplify codegen models command to generate Java models.

    After this step, you will see the following in the terminal if the project is successfully connected to the cloud:

GraphQL schema compiled successfully.
Edit your schema at amplify-android-samples/getting-started/todo/java/amplify/backend/api/todoapp/schema.graphql or place .graphql files in a directory at amplify-android-samples/getting-started/todo/java/amplify/backend/api/todoapp/schema
Successfully generated models. Generated models can be found in amplify-android-samples/getting-started/todo/java/app/src/main/java
Post-pull status:
Current Environment: dev
┌──────────┬───────────────┬───────────┬───────────────────┐
CategoryResource name │ OperationProvider plugin │
├──────────┼───────────────┼───────────┼───────────────────┤
Api │ todoapp │ No Change │ awscloudformation │
└──────────┴───────────────┴───────────┴───────────────────┘
GraphQL schema compiled successfully.
Edit your schema at amplify-android-samples/getting-started/todo/kotlin/amplify/backend/api/todoapp/schema.graphql or place .graphql files in a directory at amplify-android-samples/getting-started/todo/kotlin/amplify/backend/api/todoapp/schema
Successfully generated models. Generated models can be found in amplify-android-samples/getting-started/todo/kotlin/app/src/main/java
Post-pull status:
Current Environment: dev
┌──────────┬───────────────┬───────────┬───────────────────┐
CategoryResource name │ OperationProvider plugin │
├──────────┼───────────────┼───────────┼───────────────────┤
Api │ todoapp │ No Change │ awscloudformation │
└──────────┴───────────────┴───────────┴───────────────────┘
  1. Build and run the to-do app on an emulator or Android device in Android Studio.

App features

This app demonstrates the following features:

  • Create a task with priority
  • Sort tasks by date created, priority, or alphabetically
  • Complete a task
  • Delete a task

These features are implemented using Amplify DataStore.

  • Creating tasks and completing tasks are achieved with Amplify.DataStore.save().
  • Sorting tasks is achieved with Amplify.DataStore.query() and using Where.sorted() as the query predicate.
  • Deleting a task is achieved with Amplify.DataStore.delete().

UI experience

Shows screen by screen workflow of how Android Sample App would look like