AWS AppSync SDK for Android v2.9.0
New Features
- Support multiple authorization modes for a single AWS AppSync GraphQL endpoint.
- Introduced
clientDatabasePrefix(String)
that accepts a prefix that will be used in the construction of database name for caching query responses, offline mutations and subscriptions metadata. The usage of the prefix can be enabled by the flaguseClientDatabasePrefix(true)
. When the prefix is used, the name of the database would look as follows:
Purpose of cache | No prefix | Valid prefix |
---|---|---|
Query responses | appsyncstore |
<ClientDatabasePrefix>_appsyncstore |
Offline Mutations | appsyncstore_mutation |
<ClientDatabasePrefix>_appsyncstore_mutation |
Subscriptions metadata for Delta Sync | appsync_deltasync_db |
<ClientDatabasePrefix>_appsync_deltasync_db |
-
The
ClientDatabasePrefix
can be passed viaawsconfiguration.json
that is generated from the AWS AppSync Console and Amplify CLI."AppSync": { "Default": { "ApiUrl": "https://xyz.appsync-api.us-east-2.amazonaws.com/graphql", "Region": "us-east-2", "AuthMode": "API_KEY", "ApiKey": "da2-xyz", "ClientDatabasePrefix": "MyAppSyncAPIName_API_KEY" } }
The
AWSAppSyncClient
object can be constructed as follows:AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder() .awsConfiguration(awsConfiguration) .useClientDatabasePrefix(true) .build();
-
Alternatively, the
ClientDatabasePrefix
can be passed via theAWSAppSyncClient.Builder
.AWSAppSyncClient awsAppSyncClient = AWSAppSyncClient.builder() .context(getApplicationContext()) .apiKey(new BasicAPIKeyAuthProvider("da2-apiKey")) .serverUrl(serverUrl) .region(region) .useClientDatabasePrefix(true) .clientDatabasePrefix("MyAppSyncAPIName_API_KEY") .build();
Misc. Updates
AWSAppSync
now depends onAWSCore
version2.13.4
instead of2.13.2
.