Skip to content

A declarative library for application development using cloud services.

License

Notifications You must be signed in to change notification settings

raphkim/amplify-android

 
 

Repository files navigation

Amplify for Android (Preview)

AWS Amplify

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. AWS Amplify goes well with any Android based frontend workflow for mobile developers.

Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service.

Features/APIs

*Note: Amplify docs are still being updated and will go live by EOW. The below links will take you to the SDK documentation currently.

  • Analytics: Easily collect analytics data for your app. Analytics data includes user sessions and other custom events that you want to track in your app.
  • API: Provides a simple solution when making HTTP requests. It provides an automatic, lightweight signing process which complies with AWS Signature Version 4.
  • DataStore: Provides a persistent on-device storage repository for you to write, read, and observe changes to data if you are online or offline, and seamlessly sync to the cloud as well as across devices.
  • GraphQL Client: Interact with your GraphQL server or AWS AppSync API with an easy-to-use & configured GraphQL client.
  • Storage: Provides a simple mechanism for managing user content for your app in public, protected or private storage buckets.

All services and features not listed above are supported via the Escape Hatch with the AWS Android SDK like below:

AmazonS3Client s3Client = Amplify.Storage.getEscapeHatch();
List<Bucket> buckets = s3Client.listBuckets();

Platform Support

Amplify SDK supports Android API level 15 (Android 4.0.3) and above.

Installation

Using Gradle

Gradle can be used alongside Android Studio to declare dependencies on Amplify right out of the box via Maven central repository. To use Amplify, simply specify the module dependencies inside app's build.gradle dependencies section.

dependencies {
    // Core SDK is required for configuring Amplify
    implementation 'com.amplifyframework:core:0.9.0'
    
    // Specify only the modules that the app will use
    implementation 'com.amplifyframework:aws-datastore:0.9.0'
    implementation 'com.amplifyframework:aws-api:0.9.0'
    implementation 'com.amplifyframework:aws-storage-s3:0.9.0'
    implementation 'com.amplifyframework:aws-analytics-pinpoint:0.9.0'
}

Local Publishing of Artifacts

You can manually install the library by cloning this repo and publishing the Android modules to the local maven repository.

Execute following commands from the project root:

./gradlew publishToMavenLocal

Locally published artifacts can be accessed by specifying mavenLocal() inside the app's build.gradle file:

buildscript {
    repositories {
        mavenLocal() // This should ideally appear before other repositories
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal() // This should ideally appear before other repositories
    }
}

Using Amplify

Java 8 Compatibility

Amplify Android is dependent on Java 8 features. Please add compile options inside app's build.gradle like following:

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Using AWS Mobile Client

Authentication in Amplify for Android is dependent on AWS Mobile Client. Please refer to the this documentation for details.

You need to ensure AWSMobileClient is initialized before you initalize and configure Amplify. Please note that AWSMobileClient initialization is not required when using API or Datastore category with API Key as the authorization mode.

License

This library is licensed under the Apache 2.0 License.

About

A declarative library for application development using cloud services.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.8%
  • Other 0.2%