https://github.com/awslabs/aws-mobile-appsync-sdk-android
Android SDK for AWS AppSync.
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 41 committers (2.4%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.8%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Android SDK for AWS AppSync.
Basic Info
- Host: GitHub
- Owner: awslabs
- License: apache-2.0
- Language: Java
- Default Branch: main
- Homepage: https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
- Size: 1.38 MB
Statistics
- Stars: 107
- Watchers: 49
- Forks: 58
- Open Issues: 64
- Releases: 48
Topics
Metadata Files
README.md
Recommendation: Use Amplify clients to connect to AppSync
For front-end web and mobile development, we recommend using the Amplify clients which are optimized to connect to the AppSync backend.
- For DynamoDB data sources, use the DataStore category in the Amplify client. It provides the best developer experience and built-in conflict detection and resolution.
- For non-DynamoDB data sources in scenarios where you have no offline requirements, use the API (GraphQL) category in the Amplify client.
AWS AppSync SDK for Android
The AWS AppSync SDK for Android enables you to access your AWS AppSync backend and perform operations like queries, mutations, and subscription. The SDK also includes support for offline operations. This SDK is derrived from the Apollo project found here. Please log questions for this client SDK in this repo and questions for the AppSync service in the official AWS AppSync forum.
Platform Support
AWS AppSync SDK for Android supports Android API level 21 (Android 5.0) and above.
Samples
- A sample app using the events sample schema can be found here: https://github.com/aws-samples/aws-mobile-appsync-events-starter-android
Step by step documentation can be found here: https://aws-amplify.github.io/docs/android/api
Setup
Gradle setup
Project's build.gradle
In the project's build.gradle, add a dependency to the dependencies inside the buildscript block:
groovy
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.4.1'
Also, add the maven plugins repository to your repositories.
Do this for the repositories block under buildscript:
groovy
buildscript {
repositories {
// Add this maven block.
maven {
url "https://plugins.gradle.org/m2/"
}
google()
mavenCentral()
}
}
And also under allprojects, too:
groovy
allprojects {
repositories {
// Add this maven block.
maven {
url "https://plugins.gradle.org/m2/"
}
google()
mavenCentral()
}
}
Sample project's build.gradle
```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } google() mavenCentral() }
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.4.1'
}
}
allprojects { repositories { maven { url "https://plugins.gradle.org/m2/" } google() mavenCentral() } }
... other stuff ... ```
App's build.gradle
In the app's build.gradle, add the following plugin:
groovy
apply plugin: 'com.amazonaws.appsync'
Add the following dependency:
groovy
implementation 'com.amazonaws:aws-android-sdk-appsync:3.4.1'
Sample app's build.gradle
```groovy apply plugin: 'com.android.application' apply plugin: 'com.amazonaws.appsync'
android { // Typical items }
dependencies { // Typical dependencies implementation 'com.amazonaws:aws-android-sdk-appsync:3.4.1' } ```
App's AndroidManifest.xml
To determine if the device is offline, add permissions to access the network state:
xml
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Code generation
To interact with AppSync, your client needs to define GraphQL queries and mutations.
For example, create a file named ./app/src/main/graphql/com/amazonaws/demo/posts/posts.graphql:
```graphql query GetPost($id:ID!) { getPost(id:$id) { id title author content url version } }
mutation AddPost($id: ID!, $author: String!, $title: String, $content: String, $url: String, $ups: Int!, $downs: Int!, $expectedVersion: Int!) { putPost(id: $id, author: $author, title: $title, content: $content, url: $url, ups: $ups, downs: $downs, version: $expectedVersion) { id title author url content } } ```
Next, fetch the schema.json file from the AppSync console and place it alongside the posts.graphql file:
console
./app/src/main/graphql/com/amazonaws/demo/posts/schema.json
Now build the project and the generated source files will be available to use within the app. They will not show up in your source directory, but are added in the build path.
Create a client
Configuration via code
java
AWSAppSyncClient client = AWSAppSyncClient.builder()
.context(context)
.apiKey(new BasicAPIKeyAuthProvider(Constants.APPSYNC_API_KEY)) // API Key based authorization
.region(Constants.APPSYNC_REGION)
.serverUrl(Constants.APPSYNC_API_URL)
.build();
Configuration via a config file
Alternatively, you can use the awsconfiguration.json file to supply the configuration information required to create a AWSAppSyncClient object.
Create a file named awsconfiguration.json under your app's res/raw directory.
json
{
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"ApiKey": "YOUR-API-KEY",
"AuthMode": "API_KEY"
}
}
}
The AWSConfiguration represents the configuration information present in awsconfiguration.json file. By default, the information under Default section will be used.
java
AWSAppSyncClient client = AWSAppSyncClient.builder()
.context(context)
.awsConfiguration(new AWSConfiguration(context))
.build();
You can override the Default configuration by using the AWSConfiguration#setConfiguration() method.
json
{
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"ApiKey": "YOUR-API-KEY",
"AuthMode": "API_KEY"
},
"Custom": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-2",
"ApiKey": "YOUR-API-KEY",
"AuthMode": "API_KEY"
}
}
}
```java AWSConfiguration awsConfig = new AWSConfiguration(context); awsConfig.setConfiguration("Custom");
AWSAppSyncClient client = AWSAppSyncClient.builder() .context(context) .awsConfiguration(awsConfig) .build(); ```
Authentication Modes
When making calls to AWS AppSync, there are several ways to authenticate those calls. API key authorization (API_KEY) is the simplest way to onboard. After onboarding, we recommend you use one of the other modes:
- Amazon IAM (AWS_IAM)
- Amazon Cognito UserPools (AMAZON_COGNITO_USER_POOLS)
- Any OpenID Connect Provider (OPENID_CONNECT)
API Key
For authorization using the API key, update the awsconfiguration.json file and code snippet as follows:
Configuration
Add the following snippet to your awsconfiguration.json file.
json
{
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"ApiKey": "YOUR-API-KEY",
"AuthMode": "API_KEY"
}
}
}
Code
In order to use the information in the Default section from awsconfiguration.json file, add the following code:
java
AWSAppSyncClient client = AWSAppSyncClient.builder()
.context(context)
.awsConfiguration(new AWSConfiguration(context))
.build();
AWS IAM
For authorization using Amazon IAM credentials, using Amazon IAM or Amazon STS or Amazon Cognito, update the awsconfiguration.json file and code snippet as follows:
Configuration
Add the following snippet to your awsconfiguration.json file.
json
{
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "YOUR-COGNITO-IDENTITY-POOLID",
"Region": "us-east-1"
}
}
},
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"AuthMode": "AWS_IAM"
}
}
}
Code
Add the following code to use the information in the Default section from awsconfiguration.json file.
```java AWSConfiguration awsConfig = new AWSConfiguration(context);
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(context, awsConfig);
AWSAppSyncClient client = AWSAppSyncClient.builder() .context(context) .awsConfiguration(awsConfig) .credentialsProvider(credentialsProvider) .build(); ```
Amazon Cognito UserPools
For authorization using the Amazon Cognito UserPools, update the awsconfiguration.json file and code snippet as follows:
Configuration
Add the following snippet to your awsconfiguration.json file.
{
"CognitoUserPool": {
"Default": {
"PoolId": "POOL-ID",
"AppClientId": "APP-CLIENT-ID",
"AppClientSecret": "APP-CLIENT-SECRET",
"Region": "us-east-1"
}
},
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"AuthMode": "AMAZON_COGNITO_USER_POOLS"
}
}
}
Code
Add the following dependency to your app in order to use Amazon Cognito UserPools:
groovy
dependencies {
implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.16.12'
}
Add the following code to use the information in the Default section from awsconfiguration.json file.
```java AWSConfiguration awsConfig = new AWSConfiguration(context);
CognitoUserPool cognitoUserPool = new CognitoUserPool(context, awsConfig); BasicCognitoUserPoolsAuthProvider basicCognitoUserPoolsAuthProvider = new BasicCognitoUserPoolsAuthProvider(cognitoUserPool);
AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder() .context(context) .awsConfiguration(awsConfig) .cognitoUserPoolsAuthProvider(basicCognitoUserPoolsAuthProvider) .build(); ```
OIDC (OpenID Connect)
For authorization using any OIDC (OpenID Connect) Identity Provider, update the awsconfiguration.json file and code snippet as follows:
Configuration
Add the following snippet to your awsconfiguration.json file.
{
"AppSync": {
"Default": {
"ApiUrl": "YOUR-GRAPHQL-ENDPOINT",
"Region": "us-east-1",
"AuthMode": "OPENID_CONNECT"
}
}
}
Code
Add the following code to use the information in the Default section from awsconfiguration.json file.
java
AWSAppSyncClient client = AWSAppSyncClient.builder()
.context(context)
.awsConfiguration(new AWSConfiguration(context))
.oidcAuthProvider(() -> "jwt-token-from-oidc-provider")
.build();
Make a call
```java
public void addPost() {
GraphQLCall.Callback
@Override
public void onFailure(ApolloException failure) {
// Error handling
}
};
AddPostMutation addPostMutation = AddPostMutation.builder()
.id(UUID.randomUUID().toString())
.title(title)
.author(author)
.url(url)
.content(content)
.ups(0)
.downs(0)
.expectedVersion(1)
.build();
client.mutate(addPostMutation).enqueue(postsCallback);
} ```
License
This library is licensed under the Apache License 2.0.
Owner
- Name: Amazon Web Services - Labs
- Login: awslabs
- Kind: organization
- Location: Seattle, WA
- Website: http://amazon.com/aws/
- Repositories: 914
- Profile: https://github.com/awslabs
AWS Labs
GitHub Events
Total
- Watch event: 1
- Delete event: 1
- Push event: 2
- Pull request review event: 1
- Pull request event: 3
- Create event: 1
Last Year
- Watch event: 1
- Delete event: 1
- Push event: 2
- Pull request review event: 1
- Pull request event: 3
- Create event: 1
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| minbi | m****i | 28 |
| cbommas | c****m@a****m | 25 |
| Bommas | c****s@g****m | 24 |
| Roshan Kumar | r****r@a****m | 22 |
| Jameson Williams | j****l@a****m | 16 |
| Rafael Juliano | r****n@a****m | 11 |
| Karthikeyan | k****b@u****u | 10 |
| github-actions[bot] | 4****] | 9 |
| Divyesh Chitroda | d****h@g****m | 8 |
| Tyler Roach | t****h@a****m | 7 |
| Jacob Peddicord | j****d | 7 |
| Rohan Dubal | r****l@g****m | 6 |
| Karthikeyan Vasuki Balasubramaniam | k****a@a****m | 4 |
| Raphael Kim | 5****m | 4 |
| Tim Schmelter | s****e@a****m | 4 |
| Frank Mueller | f****e@a****m | 3 |
| Rami Baksansky | 4****k | 3 |
| Ankit Shah | 2****h | 2 |
| Chang Xu | 4****6 | 2 |
| alanMTL11 | 3****2 | 2 |
| Matt Creaser | m****r@g****m | 2 |
| Saijad Dhuka | 8****a | 2 |
| gpanshu | 9****u | 2 |
| peter-major-apadmi | 6****i | 1 |
| olga-dorogan | d****n@g****m | 1 |
| majsty | m@s****h | 1 |
| Vincent Tran | h****o@v****e | 1 |
| David Daudelin | d****i@a****m | 1 |
| Sumit | s****r@a****m | 1 |
| Thomas Leing | b****s@g****m | 1 |
| and 11 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 181
- Total pull requests: 95
- Average time to close issues: 11 months
- Average time to close pull requests: about 2 months
- Total issue authors: 66
- Total pull request authors: 19
- Average comments per issue: 4.54
- Average comments per pull request: 0.48
- Merged pull requests: 77
- Bot issues: 0
- Bot pull requests: 17
Past Year
- Issues: 0
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: about 7 hours
- Issue authors: 0
- Pull request authors: 4
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 1
Top Authors
Issue Authors
- AbdallahMustafaQasem (2)
- sandipgh19 (2)
- mkabore (2)
- TomBell-Trove (2)
- richienko (2)
- watanabethais (2)
- jtn-devecto (2)
- jamesonwilliams (2)
- AlexRs2023 (1)
- tbartley (1)
- chorniyn (1)
- ukevgen (1)
- kikichang (1)
- oras (1)
- manideepl (1)
Pull Request Authors
- tylerjroach (9)
- github-actions[bot] (9)
- div5yesh (6)
- baksansk (3)
- richardmcclellan (3)
- mattcreaser (3)
- gmulhearn (3)
- vincetran (3)
- ankpshah (3)
- gpanshu (2)
- palpatim (2)
- sdhuka (2)
- shisheng-1 (1)
- sktimalsina (1)
- reguez (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 6
- Total downloads: unknown
-
Total dependent packages: 37
(may contain duplicates) -
Total dependent repositories: 25
(may contain duplicates) - Total versions: 248
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync
AWS SDK for Android - AppSync GraphQL client library
- Homepage: https://github.com/awslabs/aws-mobile-appsync-sdk-android
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync/
- License: Apache License 2.0
-
Latest release: 3.4.2
published over 1 year ago
Rankings
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync-runtime
AWS AppSync GraphQL runtime library to support generated code
- Homepage: https://github.com/awslabs/aws-mobile-appsync-sdk-android
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync-runtime/
- License: Apache License 2.0
-
Latest release: 3.4.2
published over 1 year ago
Rankings
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync-api
AWS SDK for Android GraphQL API classes
- Homepage: https://github.com/awslabs/aws-mobile-appsync-sdk-android
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync-api/
- License: Apache License 2.0
-
Latest release: 3.4.2
published over 1 year ago
Rankings
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync-compiler
AWS AppSync Implementation for the Gradle plugin
- Homepage: https://github.com/awslabs/aws-mobile-appsync-sdk-android
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync-compiler/
- License: Apache License 2.0
-
Latest release: 3.4.2
published over 1 year ago
Rankings
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync-pom
The Amazon Web Services AppSync SDK for Android
- Homepage: http://aws.amazon.com/sdkforandroid
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync-pom/
- License: Amazon Software License
-
Latest release: 2.6.17
published almost 8 years ago
Rankings
repo1.maven.org: com.amazonaws:aws-android-sdk-appsync-gradle-plugin
Gradle plugin for generating java classes for graphql files
- Homepage: https://github.com/awslabs/aws-mobile-appsync-sdk-android
- Documentation: https://appdoc.app/artifact/com.amazonaws/aws-android-sdk-appsync-gradle-plugin/
- License: Apache License 2.0
-
Latest release: 3.4.2
published over 1 year ago
Rankings
Dependencies
- actions/checkout ee0669bd1cc54295c223e0bb666b733df41de1c5 composite
- ruby/setup-ruby b8d447ba7506ac7e0c8fbc50762276fb3b7df731 composite
- androidx.appcompat:appcompat 1.0.0 implementation
- androidx.constraintlayout:constraintlayout 1.1.3 implementation
- androidx.core:core 1.0.0 implementation
- androidx.lifecycle:lifecycle-extensions $lifecycle_version implementation
- androidx.lifecycle:lifecycle-runtime $lifecycle_version implementation
- androidx.recyclerview:recyclerview 1.0.0 implementation
- androidx.swiperefreshlayout:swiperefreshlayout 1.0.0 implementation
- com.amazonaws:aws-android-sdk-core $aws_version implementation
- com.amazonaws:aws-android-sdk-s3 $aws_version implementation
- com.google.android.material:material 1.0.0 implementation
- org.eclipse.paho:org.eclipse.paho.android.service 1.1.1 implementation
- org.eclipse.paho:org.eclipse.paho.client.mqttv3 1.2.2 implementation
- com.amazonaws:aws-android-sdk-cognitoidentityprovider $aws_version compileOnly
- com.amazonaws:aws-android-sdk-s3 $aws_version compileOnly
- org.eclipse.paho:org.eclipse.paho.android.service 1.1.1 compileOnly
- org.eclipse.paho:org.eclipse.paho.client.mqttv3 1.2.2 compileOnly
- androidx.lifecycle:lifecycle-runtime 2.0.0 implementation
- com.amazonaws:aws-android-sdk-core $aws_version implementation
- com.google.code.findbugs:jsr305 3.0.2 implementation
- com.squareup.okhttp3:okhttp 4.3.1 implementation
- com.amazonaws:aws-android-sdk-cognitoidentityprovider $aws_version testImplementation
- com.squareup.okhttp3:mockwebserver 4.3.1 testImplementation
- junit:junit 4.13 testImplementation
- org.mockito:mockito-core 3.2.4 testImplementation
- org.robolectric:robolectric 4.3.1 testImplementation
- javax.annotation:jsr250-api 1.0 api
- com.google.code.findbugs:jsr305 3.0.2 implementation
- com.squareup.okhttp3:okhttp 4.3.1 implementation
- com.google.code.findbugs:jsr305 3.0.2 implementation
- com.squareup.moshi:moshi 1.5.0 implementation
- com.squareup:javapoet 1.8.0 implementation
- org.jetbrains.kotlin:kotlin-stdlib $kotlin_version implementation
- com.android.tools.build:gradle 3.5.3 implementation
- com.github.node-gradle:gradle-node-plugin 2.2.4 implementation
- com.squareup.moshi:moshi 1.5.0 implementation
- com.nytimes.android:cache 2.1.1 api
- com.google.code.findbugs:jsr305 3.0.2 compileOnly
- com.squareup.okhttp3:okhttp 4.3.1 implementation
- addressable >= 2.8.0
- fastlane >= 0
- CFPropertyList 3.0.3
- addressable 2.8.0
- artifactory 3.0.15
- atomos 0.1.3
- aws-eventstream 1.1.1
- aws-partitions 1.488.0
- aws-sdk-core 3.119.0
- aws-sdk-kms 1.46.0
- aws-sdk-s3 1.99.0
- aws-sigv4 1.2.4
- babosa 1.0.4
- bundler 2.1.2
- claide 1.0.3
- colored 1.2
- colored2 3.1.2
- commander 4.6.0
- declarative 0.0.20
- digest-crc 0.6.4
- domain_name 0.5.20190701
- dotenv 2.7.6
- emoji_regex 3.2.2
- excon 0.85.0
- faraday 1.7.0
- faraday-cookie_jar 0.0.7
- faraday-em_http 1.0.0
- faraday-em_synchrony 1.0.0
- faraday-excon 1.1.0
- faraday-httpclient 1.0.1
- faraday-net_http 1.0.1
- faraday-net_http_persistent 1.2.0
- faraday-patron 1.0.0
- faraday-rack 1.0.0
- faraday_middleware 1.1.0
- fastimage 2.2.5
- fastlane 2.191.0
- fastlane-plugin-release_actions 1.1.0
- fastlane-plugin-semantic_release 1.13.1
- gh_inspector 1.1.3
- google-apis-androidpublisher_v3 0.10.0
- google-apis-core 0.4.1
- google-apis-iamcredentials_v1 0.6.0
- google-apis-playcustomapp_v1 0.5.0
- google-apis-storage_v1 0.6.0
- google-cloud-core 1.6.0
- google-cloud-env 1.5.0
- google-cloud-errors 1.1.0
- google-cloud-storage 1.34.1
- googleauth 0.17.0
- highline 2.0.3
- http-cookie 1.0.4
- httpclient 2.8.3
- jmespath 1.6.1
- json 2.5.1
- jwt 2.2.3
- memoist 0.16.2
- mini_magick 4.11.0
- mini_mime 1.1.0
- multi_json 1.15.0
- multipart-post 2.0.0
- nanaimo 0.3.0
- naturally 2.2.1
- os 1.1.1
- plist 3.6.0
- public_suffix 4.0.6
- rake 13.0.6
- representable 3.1.1
- retriable 3.1.2
- rexml 3.2.5
- rouge 2.0.7
- ruby2_keywords 0.0.5
- rubyzip 2.3.2
- security 0.1.3
- signet 0.15.0
- simctl 1.6.8
- terminal-notifier 2.0.0
- terminal-table 1.8.0
- trailblazer-option 0.1.1
- tty-cursor 0.7.1
- tty-screen 0.8.1
- tty-spinner 0.9.3
- uber 0.1.0
- unf 0.1.4
- unf_ext 0.0.7.7
- unicode-display_width 1.7.0
- webrick 1.7.0
- word_wrap 1.0.0
- xcodeproj 1.21.0
- xcpretty 0.3.0
- xcpretty-travis-formatter 1.0.1