class: co.ravesocial.sdk.core.RaveAppDataKeyManager

App data keys can be used to index cloud or other back-end storage data to a user’s account for a given application. App Data Keys are randomly generated IDs for each user in a 32 character hex format. When the user’s account is merged and both the source and target user of the merge have an active key for a game, the keys will enter an unresolved state and no key will be selected. This API provides the unresolved keys so that an application can provide a selection, either automatically (set by the developer) or via user input. Once a key is selected, the remaining unresolved keys will become rejected. Rejected keys can be selected at any time.

Any key in the list of all available can be selected at any time.

Note

Although the Rave SDK will work correctly in a case where no key is selected, we strongly recommend that the game ensures that a key is selected at all times during a game session. The reason is that when no key is selected, the player’s progress (or other important game data) is not indexed, and therefore progress could be lost. One way to do this is to check whether ADK is selected on game open, and during a network switch.

RaveAppDataKeysStateObserver#

Tip

Best Practice - Every application should be using this API to retrieve the selected app data key or resolve a selected key from the list of unresolved keys.

Implement RaveAppDataKeysStateObserver observer interface when using the app data keys system to track save keys for cloud storage

appDataKeyStateChanged#

This method will be called after init to establish your current identity or if you are currently in an unresolved state. It will also be called when the system has detected that, after a merge, the current user has no selected app data key. This means that both users in the merge had a selected key and a determination needs to be made about which merged key should become the selected key. See RaveAppDataKeys(Manager) for details on retrieving the unresolved keys and selecting the valid key.

public void appDataKeyStateChanged(String selectedKey, List<String> unresolvedKeys);

Parameters:

selectedKey - The key selected for this application and user unresolvedKeys - Keys that need to be resolved, there will always be zero or two or more


Listeners#

RaveAppDataKeysStateListener#

Listener to provide all possible details for application data keys for this user and application:

public void onComplete(String selectedKey, List<String> rejectedKeys, List<String> unresolvedKeys, RaveException exception);

Parameters:

selectedKey - The key selected for this application and user rejectedKeys - Keys that have been rejected for use as the selected key unresolvedKeys - Keys that need to be resolved, there will always be zero or two or more exception - An exception or null


RaveAppDataKeysListener#

Listener to fetch a subset of the app data keys information:

public void onComplete(List<String> keys, RaveException exception);

Parameters:

keys - The array of requested keys exception - An exception or null


RaveAppDataKeyListener#

Listener to fetch the selected key:

public void onComplete(String selectedKey, RaveException exception);

Parameters:

selectedKey - The app data key selected for the current user exception - An exception or null


RaveAppDataKeysManager#

Manages app data keys

setStateObserver#

Set an instance of the appDataKeysStatusObserver:

public void setStateObserver(RaveAppDataKeysStateObserver stateObserver);

Paramaters:

stateObserver - Observer for changes in status (see RaveAppDataKeysStateObserver)


getLastSelectedKey#

Cached last selected key, if any. When possible prefer key from state observer:

String getLastSelectedKey();

Returns: Last selected app key or null


fetchCurrentState#

Fetch the selected key, rejected keys, and unresolved keys for this application:

public void fetchCurrentState(RaveAppDataKeysStateListener listener);

Parameters:

listener - Provides information about data keys for the current application or an exception (see RaveAppDataKeysStateListener)


fetchUnresolved#

Fetch the set of unresolved keys, will either have a count of zero or two or more:

public void fetchUnresolved(RaveAppDataKeysListener listener);

Parameters:

listener - Listener supplying the keys or an exception (see RaveAppDataKeysListener)


fetchSelected#

Fetch the currently selected key for the user. Will be null unless a key has been selected:

public void fetchSelected(RaveAppDataKeyListener listener);

Parameters:

listener - Listener supplying the selected key or an exception (see RaveAppDataKeysListener)


fetchAvailable#

Fetch values available to be used as keys - This list will included every Rave identity associated with the current account:

public void fetchAvailable(RaveAppDataKeysListener listener);

Parameters:

listener - Listener supplying the requested keys or an exception (see RaveAppDataKeysListener)


selectKey#

Change the selected key to the specified value:

public void selectKey(String selectedKey, RaveCompletionListener listener);

Parameters:

selectedKey - The desired value of the new selected key listener - Listener suppyling an exception or null on success (see RaveCompletionListener)


deactivateKey#

Deactivates a key - Requires active network and only works for keys which are selected, rejected or unresolved:

public void deactivateKey(String key, RaveCompletionListener listener);

Parameters:

key - The key to deactivate, must be 32 character hex format listener - Listener suppyling an exception or null on success (see RaveCompletionListener)


fetchUserKey#

Returns an App Data Key when given a UUID. Essentially a lookup based on UUID:

- public void fetchUserKey(final String raveId, final AppDataKeyListener listener);

Parameters:

  • raveId - The user’s raveID you wish to look up

  • listener - A listener to be called when the operation completes. Contains a selected key or an error


fetchUserKeySet#

Fetch a set of keys given an array of RaveIDs:

- public void fetchUserKeySet(final List<String> raveIds, final AppDataKeySetListener listener);

Parameters:

  • raveIds - A List of desired Rave IDs

  • listener - A listener supplying a list of app data keys or an error


fetchUserKeySetForContacts#

Fetch the current user’s contacts app data keys:

- public void fetchUserKeySetForContacts(final AppDataKeySetListener listener);

Parameters:

  • listener - a listener to be called when the operation completes. Contains an array of app data key and rave ID pairs or an error