public class CognitoSyncManager
extends java.lang.Object
Dataset
in SQLite database. Here is a sample usage:
CognitoCachingCredentialsProvider provider = new CognitoCachingCredentialsProvider(context, awsAccountId, identityPoolId, unauthRoleArn, authRoleArn, Regions.US_EAST_1); CognitoClientManager client = new CognitoClientManager(context, Regions.US_EAST_1, provider); Dataset dataset = client.openOrCreateDataset("default_dataset"); dataset.put("high_score", "100"); dataset.synchronize(new SyncCallback() { // override callbacks });
Constructor and Description |
---|
CognitoSyncManager(android.content.Context context,
Regions region,
CognitoCachingCredentialsProvider provider)
Constructs a CognitoSyncManager object.
|
CognitoSyncManager(android.content.Context context,
Regions region,
CognitoCachingCredentialsProvider provider,
ClientConfiguration clientConfiguration)
Constructs a CognitoSyncManager object.
|
CognitoSyncManager(android.content.Context context,
java.lang.String identityPoolId,
Regions region,
CognitoCachingCredentialsProvider provider)
Deprecated.
Please use the constructor without an identityPoolId
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDeviceId()
Gets the push sync device id of the device in use.
|
PushSyncUpdate |
getPushSyncUpdate(android.content.Intent intent)
Converts the notification from Cognito push sync to an object that has
easy access to all of the relevant information.
|
boolean |
isDeviceRegistered()
Checks the cache to see if the registration information from a
registration with push synchronization is saved to the device for the
current identity.
|
java.util.List<DatasetMetadata> |
listDatasets()
Retrieves a list of datasets from local storage.
|
Dataset |
openOrCreateDataset(java.lang.String datasetName)
Opens or creates a dataset.
|
void |
refreshDatasetMetadata()
Refreshes dataset metadata.
|
void |
registerDevice(java.lang.String platform,
java.lang.String token)
Register device for push sync for the specified platform.
|
void |
subscribe(java.util.List<java.lang.String> datasetNames)
Subscribes the user to some set of datasets from the total list that the
device knows of, giving the user push sync notifications for all in that
set
|
void |
subscribeAll()
Subscribes the user to all datasets that the local device knows of for
push sync notifications, so that any changes to any of these datasets
will result in notifications to this device.
|
void |
unregisterDevice()
Unregisters the device for push sync for the current identity.
|
void |
unsubscribe(java.util.List<java.lang.String> datasetNames)
Unsubscribes the user to some set of datasets from the total list that
the device knows of, ending any reception of push sync notifications
|
void |
unsubscribeAll()
Unsubscribes the user to all datasets that the local device knows of from
push sync notifications, so that no changes to any of these datasets will
result in notifications to this device.
|
void |
wipeData()
Wipes all user data cached locally, including identity id, session
credentials, dataset metadata, and all records.
|
@Deprecated public CognitoSyncManager(android.content.Context context, java.lang.String identityPoolId, Regions region, CognitoCachingCredentialsProvider provider)
context
- a context of the appidentityPoolId
- Cognito identity pool idregion
- Cognito sync regionprovider
- a credentials providerpublic CognitoSyncManager(android.content.Context context, Regions region, CognitoCachingCredentialsProvider provider)
context
- a context of the appregion
- Cognito sync regionprovider
- a credentials providerpublic CognitoSyncManager(android.content.Context context, Regions region, CognitoCachingCredentialsProvider provider, ClientConfiguration clientConfiguration)
context
- a context of the appregion
- Cognito sync regionprovider
- a credentials providerclientConfiguration
- client configuration for underlying AWS clientpublic Dataset openOrCreateDataset(java.lang.String datasetName)
refreshDatasetMetadata()
, it will throw
IllegalStateException
.datasetName
- dataset name, must be [a-zA-Z0=9_.:-]+public java.util.List<DatasetMetadata> listDatasets()
public void refreshDatasetMetadata()
public void wipeData()
public void registerDevice(java.lang.String platform, java.lang.String token)
platform
- Platform of the device, GCM or ADMtoken
- Device token of the device, gotten when registered for the
platform in question.public java.lang.String getDeviceId()
public boolean isDeviceRegistered()
public void unregisterDevice()
public void subscribeAll()
public void subscribe(java.util.List<java.lang.String> datasetNames)
datasetNames
- The list of names of datasets to subscribe topublic void unsubscribeAll()
public void unsubscribe(java.util.List<java.lang.String> datasetNames)
datasetNames
- The list of names of datasets to unsubscribe frompublic PushSyncUpdate getPushSyncUpdate(android.content.Intent intent)
intent
- for extra the bundle returned from the intent.getExtras() callCopyright © 2010 Amazon Web Services, Inc. All Rights Reserved.