|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.mobileconnectors.cognito.CognitoSyncManager
public class CognitoSyncManager
This saves 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 Summary | |
---|---|
CognitoSyncManager(android.content.Context context,
Regions region,
CognitoCachingCredentialsProvider provider)
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 |
Method Summary | |
---|---|
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 |
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. |
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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@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 providerMethod Detail |
---|
public 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() throws DataStorageException
DataStorageException
- thrown when fail to refresh dataset metadatapublic void wipeData()
public void registerDevice(java.lang.String platform, java.lang.String token)
platform
- Platform of the device, one of GCM, ADMtoken
- Device token of the device, gotten when registered for the
platform in question.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)
extras
- the bundle returned from the intent.getExtras() call
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |