Android API Reference#
Best Practices for Common Scenarios#
Description#
This section describes usage patterns and guidelines for common integration scenarios enabled using RaveSocial APIs that venture beyond the drop-in experience found in the included scene pack.
The scene pack provides a built in user profile experience, for example, but you may create an app-specific profile experience and this guide explains some common scenarios you may encounter.
Using App Data Keys for Save Game or Cloud Storage ID#
To get a stable index for data lookup, especially if RaveID was used in the past, then RaveAppDataKeys is the recommended API to use. Simply implement the protocol RaveAppDataKeysStateObserver.
public static void appDataKeyStateChanged(String selectedKey, List<String> unresolvedKeys)
By default the selected key returned by this interface will be the current key for the current user. In a typical case, it will be a randomly generated key in a 32 character hex format. If no key had been previously selected for the current application this random key will be the default. The selected key will be non-nil provided that unresolvedKeys is empty, which will usually be the case. When there are unresolved keys, and you are online, then your integration will need to choose between the unresolved keys. Rave will never make a choice between unresolved keys, this is strictly up to the developers discretion.
The integration will choose between unresolved keys when a merge takes place between two users that have already used the current application. At this point either present the user with a choice between the unresolved keys or choose one automatically. With both keys the application can look up information about the two indexes to choose from or present the information to the user. Once a key has been chosen call RaveAppDataKeys.selectKey()
(see selectKey for more information).
User Profile Scenarios#
Code samples for custom user profile scenarios are provided in SampleRaveProfileScene.java included in your distribution package.
Accessing the current user#
RaveSocial.getCurrentUser()
is a shortcut method for accessing the current user.
Provided RaveSettings.General.AutoGuestLogin
is enabled this value should never be null, even after a log out operation. You can access a variety of fields to populate your profile screen including display name, email, and profile picture URL.
Observing the current user#
New in Rave 3.0.2 is an API to register observers for changes to the current user: RaveUsersManager.addCurrentUserObserver(). When a change occurs, usually as the result of an asynchronous operation, all registered observers will be notified with the an array of the changed properties of the current user.
It is recommended that you leverage this feature in your custom profile scene for displayName and pictureURL (or pictureImage) since they may change as a result of an asynchronous operation that you’ve triggered that didn’t explicitly change those user fields.
Observers should implement the RaveCurrentUserObserver interface, which consists of one method: RaveCurrentUserObserver.userChanged(Collection<String>).
@Override
void userChanged(Collection<String> changedKeys) {
if (changedKeys.contains("displayName")) {
// Update UI with new display name
} else if (changedKeys.contains("pictureImage")) {
// Update UI with new profile picture
} else if (changedKeys.contains("pictureURL")) {
// Update picture image
}
}
Displaying the profile picture#
The current user has a reference to the pictureURL, it is always a remotely stored image. It will either be stored on Rave’s servers or on a third party’s server, depending on the source of the image.
Android provides access to the image URL through RaveSocial.getCurrentUser().getPictureURL()
Changing the profile picture#
There is a common method on all platforms that takes a local file url and pushes the binary data for the image to the Rave backend so that the profile picture is available on any device.
String imageURL = someLocalImageURL;
RaveSocial.usersManager.pushProfilePicture(imageURL, new RaveCompletionListener() {
@Override
public void onComplete(RaveException exception) {
if (exception) {
// do something in the error case
}
}
});
Changing the display name#
New in Rave 3.0.2 is an API to modify the current user without staging the changes in the model. RaveUsersManager.pushUserChanges(RaveUserChanges changes, RaveCompletionListener listener).
RaveUserChanges changes = new RaveUserChanges();
changes.displayName = someOtherName;
RaveSocial.usersManager.pushUserChanges(changes, new RaveCompletionListener() {
@Override
public void onComplete(RaveException exception) {
if (exception) {
// do something to handle the exception
}
}
});
Use this new method rather than the legacy method RaveUsersManager.pushCurrent().
Logging out#
If RaveSettings.General.AutoGuestLogin
is enabled a new anonymous user will automatically be created when you log out. Prior to the logOut completion listener firing it is suggested that you prevent the user from interacting with Rave similar to what is shown in the snippet below.
RaveSocial.getProgressDisplay().show("Signing out...", null);
RaveSocial.logOut(new RaveCompletionListener() {
@Override
public void onComplete(RaveException exception) {
RaveSocial.getProgressDisplay().dismiss();
if (exception) {
// do something to handle the exception
}
}
});
Opening common scenes#
Opening the login scene#
Opening the login scene allows the user to sign in using their BigFish account. It also provides the user with a convenient shortcut to the create account scene through a button. The following example code shows an example of showing the scene and also capturing the result of any login or account creation that occurs. In the case that an account is created the result will be successful and the signup data will be valid. For details of the signup data see the appropriate documentation in the BigFishScenePack.
RaveLoginScene loginScene = new RaveLoginScene(context);
loginScene.setListener(new BigFishSignUpDataListener() {
@Override
public void onComplete(RaveCallbackResult result, BigFishSignUpData signUpData, RaveException exception) {
if (result == RESULT_SUCCESSFUL && signUpData != null) {
// do something
} else if (result == RESULT_CANCELED) {
// do something else
} else {
// show error message if deemed appropriate
}
});
loginScene.show();
Opening the create account scene#
Opening the sign up email scene allows the user to create a BigFish account. It also provides the user with a convenient shortcut to the login scene through a button. The following example code shows an example of showing the scene and also capturing the result of any login or account creation that occurs. In the case that an account is created the result will be successful and the signup data will be valid. For details of the signup data see the appropriate documentation in the BigFishScenePack.
RaveSignUpEmailScene signUpScene = new RaveSignUpEmailScene(context);
signUpScene.setListener(new BigFishSignUpDataListener() {
@Override
public void onComplete(RaveCallbackResult result, BigFishSignUpData signUpData, RaveException exception) {
if (result == RESULT_SUCCESSFUL && signUpData != null) {
// do something?
} else if (result == RESULT_CANCELED) {
// do something else?
} else {
// show error message if deemed appropriate
}
}
});
signUpScene.show();
Opening the Find Friends scene#
You’ll want to show the Find Friends scene if you want an easy way to attract users to attaching Facebook, Google, Phonebook contacts, etc. to their Rave account.
RaveFindFriendsScene findFriendsScene = new RaveFindFriendsScene(context);
findFriendsScene.setListener(new RaveSceneListener() {
@Override
public void onSceneComplate(boolean cancelled, RaveException exception) {
// capture when this scene is closed if desired
}
});
AppDataKeys API#
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 uplistener
- 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 IDslistener
- 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
Controllers API#
RaveConnectFriendsController#
class: co.ravesocial.sdk.ui.RaveConnectFriendsController
Enum RaveFindFriendsState#
FIND_FRIENDS_STATE_NOT_DOWNLOADED
: Friends syncing is not enabledFIND_FRIENDS_STATE_DOWNLOADING
: Friends sycning is in progressFIND_FRIENDS_STATE_DOWNLOADED
: Friends sycning is enabled
Interface RaveConnectFriendsStateObserver#
Implement this observer to track state changes in the controller to keep your UI up-to-date:
void onFindFriendsStateChanged(RaveFindFriendsState value);
Parameters:
value
- Latest state value
RaveConnectFriendsController#
Constructor for new friends controller:
public RaveConnectFriendsController(String pluginKeyName);
Parameters:
pluginKeyName
- Key for the plugin to use with this controller instance
Returns: Instance of RaveConnectFriendsController for the plugin specified
getDownloaded#
Check this value to see if the controller has downloaded your contacts:
public boolean getDownloaded();
Returns: True or false based on latest status
setFriendsObserver#
Implement RaveConnectFriendsStateObserver and set your observer instance in the controller:
public void setFriendsObserver(RaveConnectFriendsStateObserver observer);
Parameters:
observer
- Reference to object implementing the state observer. Recommend you have a unique observer for each controller/plugin pair.
syncFriends#
Trigger sync friends operation asynchronously. Track state changes through the observer:
public void syncFriends();
Note: Typically you will call attemptGetFriends instead.
attemptGetFriends#
Attempt to sync friends asynchronously. Checks internal logic to ensure that the plugin is enabled and that friends haven’t already been synced. If the user is authenticated will attempt to connect the plugin to the curent user in addition to syncing friends. Track changes to state through the observer:
public void attemptGetFriends();
attemptForgetFriends#
Attempt to stop syncing friends asynchronously. Checks internal logic to ensure that the plugin is enabled and that friends have been synced. If the user is authenticated this call will attempt to disconnect the plugin from the current user in addition to stopping syncing. Track changes to state through the observer:
public void attemptForgetFriends();
RaveConnectController#
Enum ConnectState#
CONNECT_STATE_DISABLED
: Controller is disabled, plugin isn’t availableCONNECT_STATE_CONNECTED
: Controller is connected, plugin is ready to useCONNECT_STATE_CONNECTING
: Controller is in the process of asynchronously attempting to connect, plugin is not readyCONNECT_STATE_DISCONNECTED
: Controller is disconnected, plugin is not readyCONNECT_STATE_DISCONNECTING
: Controller is in the process of asynchronously attempting to disconnect, plugin is not ready
Interface RaveConnectStateObserver#
Implement this observer to track state changes to the controller to keep your UI up-to-date:
void onConnectStateChanged(ConnectState state);
Parameters:
state
- Latest state value
RaveConnectController#
Constructor for instances of RaveConnectController:
public RaveConnectController(String pluginKeyName);
public RaveConnectController(String pluginKeyName, boolean autoUpdate);
Parameters:
pluginKeyName
- Key name for plugin to use for this controller
autoUpdate
- True to automatically update connect state when observer is set (defaults to false)
Returns: Instance of RaveConnectController for the plugin specified
setObserver#
Implement RaveConnectStateObserver and set your instance in the controller using setObserver:
public void setObserver(RaveConnectStateObserver observer);
Parameters:
observer
- Observer instance. Recommended that you have a different instance per plugin/controller pair.
attemptConnect#
Attempt to connect asynchronously. Checks internal logic to ensure that the plugin is enabled and plugin isn’t already connected. Track changes to state through the observer:
public void attemptConnect();
attemptDisconnect#
Attempt to disconnect asynchronously. Checks internal logic to ensure that the plugin is connected. Track changes to state through the observer:
public void attemptDisconnect();
updateConnectState#
Refresh the connect state of the controller with the plugin. Track changes to state through the observer:
public void updateConnectState();
Called automatically if autoUpdate is true for this controller.
setPluginKeyName#
Set the pluginKeyName for this controller. Typically shouldn’t be changed after construction:
public void setPluginKeyName(String pluginKeyName);
Parameters:
pluginKeyName
- Key name for plugin to use
setCallback#
Set callback for asynchronous operations on this controller. Used to track errors that occur in the course of normal operations:
public void setCallback(RaveCompletionListener listener);
Parameters:
listener
- Completion listener for error handling (see RaveCompletionListener)
Authenticated Merging API#
There are several important decision points that can occur during an authenticated merge that need to be handled carefully for a successful integration. As a result, authenticated merging is not enabled unless an integrator sets an instance of a RaveMergePolicy. A demonstration policy will be provided in your accompanying scene pack and demo.
To enable merging set an instance of RaveMergePolicy via RaveSocial.setMergePolicy()
. A merge attempt will typically be triggered during a connect operation when attempting to add an authentication source during an account. See Account conflict resolution for more information about conflict scenarios. You are strongly discouraged from automatically deciding to accept the merge as two accounts cannot be unmerged once merged. This obviously could have unintended effects on a player’s progress.
Interface RaveMergeDecisionListener#
When a merge policy is invoked you’re given a listener of this type that the SDK uses to determine when your user has decided whether to accept the potential merge.
mergeDecision#
Call this method on the listener after the user has decided whether to accept the potential merge with the result of their decision.
void mergeDecision(boolean shouldMerge);
Parameters:
shouldMerge
- True if the user decided to proceed with the merge, otherwise false
Interface RaveMergeUser#
A typical RaveUser with one additional field added - selectedAppDataKey so that you can potentially preview save game data for the other user.:
String getSelectedAppDataKey();
Interface RaveMergePolicy#
This policies method will be invoked when a decision point is reached for triggering a merge during an account conflict.
void makeMergeDecision(RaveMergeUser targetUser, RaveMergeDecisionListener listener);
Parameters:
targetUser
- User the current user will be merged into. Some fields will be filled out, such as displayName and profile picture URL so that you can help the user decide whether or not they mean to merge.
listener
- Merge decision listener, call mergeDecision after user has indicated whether they want to continue the merge. You are strongly discouraged from automatically deciding to merge.
Note
See BigFishMergePolicy.java in BigFishScenePack package for a possible default implementation of a merge policy
Achievements API#
class: co.ravesocial.sdk.core.RaveAchievements
Note
In order to use achievements in your application, you must define your achievements in the Rave Developer Portal. See the Achievements section in the portal documentation for instructions on how to create acheivements.
getAchievementByKey#
Retrieve a RaveAchievement from the local cache based on key.
public RaveAchievement getAchievementByKey(String key);
Parameters:
key
- Key for a matching achievement
Returns: Reference to a RaveAchievement or null if no match is found
updateAchievements#
Retrieve all Rave achievements from the server and update the local cache with the retrieved data.
public void updateAchievements(RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the update is completed (see RaveCompletionListener)
getAchievements#
Retrieves all achievements stored in the local cache.
public List<RaveAchievement> getAchievements()
Returns: A List
of RaveAchievement
objects.
unlockAchievement#
Unlock an achievement for the current user, specified by achivement key.
public void unlockAchievement(String achievementKey, RaveCompletionListener listener)
Parameters:
achievementKey
- A string containing the key of the achievement to be unlocked
listener
- Listener to call when the unlock achievement operation is completed (see RaveCompletionListener)
Contacts API#
class: co.ravesocial.sdk.core.RaveContacts
startFriendSyncFor#
Method to start updating Rave contacts using the service specified
This typically will require the user to authenticate using that service
Will enable future updates to happen automatically based on RaveSettings.General.ContactsUpdateInterval Will automatically be called by RaveSocial.connectTo if RaveSettings.General.AutoSyncFriends includes a key matching pluginKeyName:
public static void startFriendSyncFor(String pluginKeyName, RaveCompletionListener listener);
Parameters:
pluginKeyName
- The key for the plugin to sync friends with
callback
- Callback will return nil on success otherwise an error (see RaveCompletionListener)
Usage example:
if (RaveAuthentication.getCurrentTokenFrom(RaveConstants.CONNECT_PLUGIN_FACEBOOK) != null) {
RaveContacts.startFriendSyncFor(RaveConstants.CONNECT_PLUGIN_FACEBOOK, new RaveCompletionListener() {
@Override
public void onComplete(RaveException exception) {
if (exception != null) {
// do something with error
}
}
});
}
stopFriendSyncFor#
Method to stop updating Rave contacts using the service specified
Disables future syncing for the service specified by pluginKeyName:
public static void stopFriendSync(String pluginKeyName);
Parameters:
pluginKeyName
- The key for the plugin to sync friends with
getContactByRaveId#
Retrieve a RaveContact from the local cache based on user id.
public RaveContact getContactByRaveId(String raveId);
Parameters:
raveId
- User id to key the search for a matching contact
Returns: Reference to a RaveContact or null if no match is found
updateAll#
Retrieve all Rave contacts from the server and update the local cache with the retrieved data.
public void updateAll(final RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the update is completed (see RaveCompletionListener)
updateAllUsingThisApplication#
Retrieve all Rave contacts from the server that also use the current application and update the local cache with the retrieved data.
public void updateAllUsingThisApplication(final RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the update is completed (see RaveCompletionListener)
updateAllUsingApplication#
Retrieve all Rave contacts from the server that also use the specified application and update the local cache with the retrieved data.
public void updateAllUsingApplication(String applicationId, final RaveCompletionListener listener)
Parameters:
applicationId
- Rave Application ID of the specified application
listener
- Listener to call when the update is completed (see RaveCompletionListener)
getAll#
Retrieves all contacts stored in your Rave account from the local cache.
public List<RaveContact> getAll()
Returns: A List of RaveContact objects.
getAllUsingThisApplication#
Retrieves all contacts stored in your Rave account that also use the current application from the local cache.
public List<RaveContact> getAllUsingThisApplication()
Returns: A List of RaveContact objects.
getAllUsingApplication#
Retrieves all contacts stored in your Rave account that also use the specified application from the local cache.
public List<RaveContact> getAllUsingApplication(String applicationId)
Parameters:
applicationId
- Rave Application ID of the specified application
Returns: A List of RaveContact objects.
updateFacebook#
Retrieve all Rave contacts, that originated from Facebook, from the server and update the local cache with the retrieved data.
public void updateFacebook(final RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the update is completed (see RaveCompletionListener)
getFacebook#
Retrieves all contacts that originated from Facebook stored in your Rave account from the local cache.
public List<RaveContact> getFacebook()
Returns: A List of RaveContact objects.
deleteContact#
Delete a specified Rave contact and notify the server of the deletion.
public void deleteContact(String raveId, RaveCompletionListener listener)
Parameters:
raveId
- Rave User ID of the specified contact
listener
- Listener to call when the server has completed the delete operation (see RaveCompletionListener)
addContactsByUsername#
Manually add contacts by username. Username is any arbitrary string that is used to identify the contact.
public void addContactsByUsername(final List<String> usernames, RaveCompletionListener listener)
Parameters:
usernames
- A list of usernames to add as contacts
listener
- Listener to call when the server has completed the add contact operation (see RaveCompletionListener)
addPhoneBookContactsByEmail#
Manually add contacts by email and mark them as phonebook contacts:
public void addPhoneBookContactsByEmail(final List<String> emails, RaveCompletionListener listener)
Parameters:
emails
- A list of emails to add as contacts under the phonebook source
listener
- Listener to call when the server has completed the add contact operation (see RaveCompletionListener)
fetchExternalFromAll#
Fetch all external contacts/friends from all contact providers and filter them as specified.
public void fetchExternalFromAll(final RaveContactsFilter filter, final RaveContactsListener listener)
Parameters:
filter
- Filter to use for fetching contacts. RaveContactsFilter enum: INCLUDE_ALL, INCLUDE_ONLY_USING_APP,
EXCLUDE_USING_APP
listener
- Listener to call when the server has completed the fetch operation and returns the list of fetched
contacts
fetchExternalFrom#
Fetch all external contacts/friends from a contacts provider and filter them as specified.
public void fetchExternalFrom(final String pluginKeyName, final RaveContactsFilter filter, final RaveContactsListener
listener)
Parameters:
pluginKeyName
- Contacts provider plugin. Plugin key constants are found in the static RaveConstants class
filter
- Filter to use for fetching contacts. RaveContactsFilter
enum: INCLUDE_ALL
,
INCLUDE_ONLY_USING_APP
, EXCLUDE_USING_APP
listener
- Listener to call when the server has completed the fetch operation and returns the list of fetched
contacts
Gifts API#
class: co.ravesocial.sdk.core.RaveGifts
Note
In order to use gifts or requests in your application, you must define your gifts that can be given or requested in the Rave Developer Portal. See the Gifts section in the portal documentation for instructions on how to create gifts.
getGiftTypes#
- Returns the cached list of gift types::
public List<RaveGiftType> getGiftTypes()
Returns: The list of cached gift types for this application
getGiftTypeByName#
- Returns a gift type by name::
public RaveGiftType getGiftTypeByName(String name)
Parameters:
name
- The name of the gift type
Returns: A RaveGiftType or null if no matching
getGiftTypeByKey#
Returns a gift type by key:
public RaveGiftType getGiftTypeByKey(String key)
Parameters:
key
- The key of the gift type
Returns: A RaveGiftType or null if no matching
updateGiftTypes#
- Get the list of gift types for this application::
public void updateGiftTypes(RaveCompletionListener listener)
Parameters:
listener
- Server response callback for gift types (see RaveCompletionListener)
getGifts#
- Gets a list of the gifts cached for this user::
public List<RaveGift> getGifts()
Returns: The list of cached gifts for this user
updateGifts#
- Updates the list of gifts from the server::
public void updateGifts(RaveCompletionListener listener)
Parameters:
listener
- Response callback upon completion of the request (see RaveCompletionListener)
getGiftById#
Returns a gift by giftId:
public RaveGift getGiftById(String giftId)
Parameters:
giftId
- The giftId to use
Returns: A RaveGift or null if not found or not synced locally
getGiftRequestById#
Returns a gift request by giftRequestId:
public RaveGiftRequest getGiftRequestById(String giftRequestId)
Parameters:
giftRequestId
- The giftRequestId to use
Returns: A RaveGiftRequest or null if not found or not synced locally
sendGiftWithKeyToUsers#
Sends a gift to multiple users.
The maximum number of users that can be sent to in one call is 20
public void sendGiftWithKeyToUsers(String giftTypeKey, List<String> userIds, RaveGiftResultListener listener)
Parameters:
giftTypeKey
- giftTypeKey The key of the gift type to send
userIds
- A list of RaveIDs to send to
listener
- result listener
sendGiftToUsers#
Send a gift to multiple users:
public void sendGiftToUsers(RaveGiftType giftType, List<RaveUser> users, RaveGiftResultListener listener)
Parameters:
giftType
- The type of the gift to send
users
- The list of users to send to the gift to, internally converted
listener
- Optional result callback to track success or failure of operation
acceptGift#
Accept a gift:
public void acceptGift(RaveGift gift, RaveCompletionListener listener)
Parameters:
gift
- The gift to accept
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
acceptGiftById#
Accept gift by gift ID:
public void acceptGiftById(String giftId, RaveCompletionListener listener)
Parameters:
giftId
- The gift ID for the gift to accept
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
rejectGift#
Reject a gift:
public void rejectGift(RaveGift gift, RaveCompletionListener listener)
Parameters:
gift
- The gift to reject
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
rejectGiftById#
Reject a gift by gift ID:
public void rejectGiftById(String giftId, RaveCompletionListener listener)
Parameters:
giftId
- The ID of the gift to reject
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
getGiftRequests#
Returns the list of cached gift requests:
public List<RaveGiftRequest> getGiftRequests()
Returns: The list of cached gift requests
updateGiftRequests#
Updates the local cache of gift requests from the server:
public void updateGiftRequests(RaveCompletionListener listener)
Parameters:
listener
- Response callback upon completion of the request (see RaveCompletionListener)
requestGiftWithKeyFromUsers#
Request a gift from a group of Rave users:
public void requestGiftWithKeyFromUsers(String giftTypeKey, List<String> userIds, RaveGiftResultListener listener)
Parameters:
giftTypeKey
- The key of the gift type being requested
userIds
- The Rave IDs of the users targeted by the request
listener
- Optional result callback to track success or failure of operation
requestGiftFromUsers#
Request a gift from a group of Rave users:
public void requestGiftFromUsers(RaveGiftType giftType, List<RaveUser> users, RaveGiftResultListener listener)
Parameters:
giftType
- The gift type requested
users
- The users targeted by the request
listener
- Optional result callback to track success or failure of operation
grantGiftRequest#
Grant gift request:
public void grantGiftRequest(RaveGiftRequest giftRequest, RaveCompletionListener listener)
Parameters:
giftRequest
- The gift request to grant
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
grantGiftRequestById#
Grant gift request by request ID:
public void grantGiftRequestById(String requestId, RaveCompletionListener listener)
Parameters:
requestId
- The request ID for the gift request to grant
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
ignoreGiftRequest#
Ignore gift request:
public void ignoreGiftRequest(RaveGiftRequest giftRequest, RaveCompletionListener listener)
Parameters:
giftRequest
- The gift request to ignore
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
ignoreGiftRequestById#
Ignore a gift request by request ID:
public void ignoreGiftRequestById(String requestId, RaveCompletionListener listener)
Parameters:
requestId
- The UUID of the gift request to ignore
listener
- Optional result callback to track success or failure of operation (see RaveCompletionListener)
sendGiftWithKeyToContacts#
Send a gift to a list of Rave contacts:
public void sendGiftWithKeyToContacts(String giftTypeKey, List<RaveContact> contacts, RaveContactsGiftResultListener listener)
Parameters:
giftTypeKey
- The key of the gift type to send
contacts
- A list of RaveContacts to send to
listener
- Optional result callback to track success or failure of operation
attachGiftWithKey#
- Attach a gift to a share request to give the user a gift when they click through the request on the social network::
public void attachGiftWithKey(String giftTypeKey, List<RaveShareRequest> shareRequests, final RaveCompletionListener listener)
Parameters:
giftTypeKey
- The key of the gift type to attach
shareRequests
- The share request to attach the gift to
listener
- Optional result callback to track success or failure of operation
fetchGiftKeyForExternalId#
Checks the server to see if there is a gift type queued for the externalId:
public void fetchGiftKeyForExternalId(String externalId, String source, RaveGiftKeyListener listener)
Parameters:
externalId
- The external ID (requestId or other)
source
- The social network source
listener
- The callback with the gift type data
detachGiftKeyForExternalId#
Detaches the queued gift key from the externalId:
public void detachGiftKeyForExternalId(String externalId, String source, RaveGiftKeyListener listener)
Parameters:
externalId
- The external ID (requestId or other)
source
- The social network source
listener
- The callback with the gift type data
Leaderboards API#
class: co.ravesocial.sdk.core.RaveLeaderboards
Note
In order to use leaderboards in your application, you must define your leaderboards in the Rave Developer Portal. See the Leaderboards and Tournaments / Timed Leaderboards section in the portal documentation for instructions on how to create leaderboards.
updateLeaderboards#
Updates the list of leaderboards from the server:
public void updateLeaderboards(RaveCompletionListener listener)
Parameters:
listener
- A completion listener
getLeaderboards#
Retrieves the list of leaderboards from cache:
public List<RaveLeaderboard> getLeaderboards()
Returns: A list of RaveLeaderboard
objects
updateLeaderboard#
Updates a leaderboard from the server:
public void updateLeaderboard(String key, RaveCompletionListener listener)
Parameters:
key
- The leaderboard key
listener
- A completion listener
getLeaderboard#
Gets a leaderboard by key:
public RaveLeaderboard getLeaderboard(String leaderboardKey)
Parameters:
leaderboardKey
- The key
Returns: A RaveLeaderboard
or null if no leaderboard by that name or no leaderboards synced
submitScore#
Submits a score to a leaderboard:
public void submitScore(String leaderboardKey, int score, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard
score
- The score to submit
listener
- A completion listener
updateGlobalScores#
Updates a leaderboard’s global scores from the server:
public void updateGlobalScores(String leaderboardKey, int page, int pageSize, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
page
- Which page to update
pageSize
- The size of the page (max 50)
listener
- A completion listener
getGlobalScores#
Gets the global scores from local cache:
public List<RaveScore> getGlobalScores(String leaderboardKey, int page, int pageSize)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
page
- Which page to get
pageSize
- The size of the page (max 50)
Returns: A List
of RaveScore
objects
updateFriendsScores#
Updates the user’s friends’ scores for a leaderboard from the server:
public void updateFriendsScores(String leaderboardKey, int page, int pageSize, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
page
- Which page to update
pageSize
- The size of the page (max 50)
listener
- A completion listener
getFriendsScores#
Gets the user’s friends’ scores for a leaderboard from local cache:
public List<RaveScore> getFriendsScores(String leaderboardKey, int page, int pageSize)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
page
- Which page to get
pageSize
- The size of the page (max 50)
Returns: A List
of RaveScore
objects
.updateMyGlobalScores#
Updates the page of scores which has the user’s current global score for a leaderboard from the server.
public void updateMyGlobalScores(String leaderboardKey, int pageSize, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
pageSize
- The size of the page (max 50)
listener
- A completion listener
getMyGlobalScores#
Gets the page of scores which has the user’s global scores for a leaderboard from local cache.
This method returns the page of scores which has the user’s current score.
public List<RaveScore> getMyGlobalScores(String leaderboardKey, int pageSize)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
pageSize
- The size of the page (max 50)
Returns: A List
of RaveScore
objects
updateMyFriendsScores#
Updates the page of friends’ scores which has the user’s score for a leaderboard from the server.
public void updateMyFriendsScores(String leaderboardKey, int pageSize, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
pageSize
- The size of the page (max 50)
listener
- A completion listener
getMyFriendsScores#
Gets the user’s friends’ scores for a leaderboard from local cache.
This method returns the page of friends’ scores which has the user’s current score:
public List<RaveScore> getMyFriendsScores(String leaderboardKey, int pageSize)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
pageSize
- The size of the page (max 50)
Returns: A List
of RaveScore
objects
updateMyGlobalScoresAdjacent#
Updates the user’s global scores with adjacency for a leaderboard from the server.
This method centers the list of scores on the user’s current score.
public void updateMyGlobalScoresAdjacent(String leaderboardKey, int adjacent, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
adjacent
- The number of adjacent scores (before and after the users score) to show
listener
- A completion listener
getMyGlobalScoresAdjacent#
Gets the user’s global scores with adjacency for a leaderboard from local cache
This method centers the list of scores on the user’s current score. The list of scores will be up to 2*adjacent+1 in size depending on the user’s position in the list. If the user is in the first or last adjacent number of scores, there will be less results.
public List<RaveScore> getMyGlobalScoresAdjacent(String leaderboardKey, int adjacent)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
adjacent
- The number of adjacent scores (before and after the users score) to show
Returns: A List
of RaveScore
objects
updateMyFriendsScoresAdjacent#
Updates the user’s friends’ scores with adjacency for a leaderboard from the server.
This method centers the list of scores on the user’s current score.
public void updateMyFriendsScoresAdjacent(String leaderboardKey, int adjacent, RaveCompletionListener listener)
Parameters:
leaderboardKey
- The key of the leaderboard to update
adjacent
- The number of adjacent scores (before and after the users score) to show
listener
- A completion listener
getMyFriendsScoresAdjacent#
Gets the user’s friends’ scores with adjacency for a leaderboard from local cache
This method centers the list of scores on the user’s current score. The list of scores will be up to 2*adjacent+1 in size depending on the user’s position in the list. If the user is in the first or last adjacent number of scores, there will be less results.
public List<RaveScore> getMyFriendsScoresAdjacent(String leaderboardKey, int adjacent)
Parameters:
leaderboardKey
- The key of the leaderboard to get for
adjacent
- The number of adjacent scores (before and after the users score) to show
Returns: A List
of RaveScore
objects
getHighScore#
Gets the current high score for a leaderboard from cache:
public Integer getHighScore(String leaderboardKey)
Parameters:
leaderboardKey
- The key of the leaderboard
Returns: The current high score
getGlobalPosition#
Gets the user’s global position in a leaderboard from cache:
public Integer getGlobalPosition(String leaderboardKey)
Parameters:
leaderboardKey
- The key of the leaderboard
Returns: The current global position
getFriendsPosition#
Gets the user’s position amongst friends in a leaderboard from cache:
public Integer getFriendsPosition(String leaderboardKey)
Parameters:
leaderboardKey
- The key of the leaderboard
Returns: The current position amongst friends
getLeaderboardScores#
Gets the user’s scores given a request:
public List<RaveScore> getLeaderboardScores(RaveLeaderboardsRequest request)
Parameters:
request
- A leaderboard request.
Returns: The list of scores for the request.
Users API#
class: co.ravesocial.sdk.core.RaveUsersManager
convenience class: co.ravesocial.sdk.core.RaveUsers
Main API for accessing and changing Rave users
Interface - RaveCompletionListener#
Completion listener interface for general use:
public interface RaveCompletionListener {
public void onComplete(RaveException exception);
}
Interface - RaveCurrentUserObserver#
Observer interface for changes to the current user:
public static interface RaveCurrentUserObserver {
public void userChanged(Container<String> changedKeys);
}
Parameters:
changedKeys
- A collection of keys that specifies which data has changed. Keys will match method names in RaveUser, in camel case. Example: getAccountState = “accountState”.
Interface - RaveUsersListener#
Completion listener interface for returning a list of users:
public static interface RaveUsersListener {
public void onComplete(List<RaveUser> users, RaveException exception);
}
Interface - RaveIdentitiesListener#
Completion listener interface for returning a list of merged identities by ID:
public static interface RaveIdentitiesListener {
public void onComplete(List<String> mergedIdentities, RaveException exception);
}
Interface - RaveAccountExistsListener#
Completion listener interface for returning whether or not an account exists and has had a password assigned:
public static interface RaveAccountExistsListener {
public void onComplete(boolean exists, boolean hasPassword, RaveException exception);
}
updateCurrent#
Retrieve the current user’s data from the server and update the local cache with the retrieved data.
public void updateCurrent(final RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the update is completed
getCurrent#
Gets the current user stored in the local cache.
public RaveUser getCurrent()
Returns: A RaveUser object representing the current user
addCurrentUserObserver - New in 3.0.2#
Register an observer for the current user, multiple concurrent users may be registered at once:
public void addCurrentUserObserver(RaveCurrentUserObserver observer);
Parameters:
observer
- Observer for changes to the current user
removeCurrentUserObserver - New in 3.0.2#
Unregister an observer for the current user, multiple concurrent users may be registered at once:
public void removeCurrentUserObserver(RaveCurrentUserObserver observer);
Parameters:
observer
- Observer to unregister
pushUserChanges - New in 3.0.2#
Push changes to the current user to the Rave backend. User state notifications will be triggered if successful:
public void pushUserChanges(RaveUserChanges userChanges, RaveCompletionListener listener);
Parameters:
userChanges
- The set of changes to the current user (see RaveUserChanges for more details)
listener
- Listener to call when the operation is completed
pushProfilePicture#
Push the binary data for a local image to the Rave backend for a users profile picture:
public void pushProfilePicture(String uploadSourcePath, RaveCompletionListener listener);
Parameters:
uploadSourcePath
- The path specifying the local image to upload
listener
- Listener to call when the operation is completed
pushProfilePicture#
Pushes the image at the provided source path up to the server to be stored as the new profile picture.
public void pushProfilePicture(String uploadSourcePath, RaveCompletionListener listener)
Parameters:
uploadSourcePath
- Local file file path to the image to be used as the new profile picture
listener
- Listener to call when the push operation is completed
fetchRandomUsersForApplication#
Fetches a set of random users from the server. Will return up to 10 random users who are using the current application.
public void fetchRandomUsersForApplication(final RaveUsersListener listener)
Parameters:
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
fetchRandomUsersForApplication#
Fetches a set of random users from the server. Will return up to 10 random users who are using the application specified by the appUuid. The specified application must belong to the same publisher as the current application.
public void fetchRandomUsersForApplication(String appUuid, final RaveUsersListener listener)
Parameters:
appUuid
- Unique ID of the application whose users you wish to fetch
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
fetchRandomUsersForApplication#
Fetches a set of random users from the server. Will return up to 10 random users who are using the application specified by the appUuid. The specified application must belong to the same publisher as the current application.
public void fetchRandomUsersForApplication(String appUuid, final RaveUsersListener listener)
Parameters:
appUuid
- Unique ID of the application whose users you wish to fetch
excludeContacts
- If the current user’s contacts are included in the results
limit
- The maximum number of users to return, up to 25
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
updateUserById#
Given a Rave ID, retrieve a user’s data from the server and update the local cache with the retrieved data.
public void updateUserById(String raveId, RaveCompletionListener listener)
Parameters:
raveId
- The Rave ID of the user
listener
- Listener to call when the update is completed
getUserById#
Gets the current user stored in the local cache.
public RaveUser getUserById(String raveId)
Parameters:
raveId
- The Rave ID of the user
Returns: A RaveUser object representing the retrieved user. Returns null if the user doesn’t exist or isn’t stored in the local cache.
fetchAccessToken#
Fetch an access token that can be used to query the Rave back-end server.
public void fetchAccessToken(final AccessTokenListener listener)
Parameters:
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
fetchIdentities#
Fetch all identities associated with the current user. A single user can contain multiple merged identities across games/devices/logins.
public void fetchIdentities(RaveIdentitiesListener listener)
Parameters:
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
fetchIdentitiesForApplication#
Fetch only identities associated with the current user that are associated with the current application. A single user can contain multiple merged identities across games/devices/logins.
public void fetchIdentitiesForApplication(RaveIdentitiesListener listener)
Parameters:
listener
- Listener to call when the fetch operation is completed. The listener is passed the retrieved data
checkThirdPartyAccountExists#
Check if the current third party source contains an account associated with the provided email address.
public void checkThirdPartyAccountExists(String email, final RaveAccountExistsListener listener)
Parameters:
email
- The email address to check against
listener
- Listener to call when the check operation is completed. The listener is passed the retrieved data
checkAccountExists#
Check if there is a Rave acccount associated with the provided email address.
public void checkAccountExists(String email, final RaveAccountExistsListener listener)
Parameters:
email
- The email address to check against
listener
- Listener to call when the check operation is completed. The listener is passed the retrieved data
blockUser#
Block a user.
public void blockUser(RaveUserReference reference, RaveCompletionListener listener)
Parameters:
reference
- Reference to the user to block
listener
- Completion listener
unblockUser#
Unblock a user.
public void unblockUser(String raveId, RaveCompletionListener listener)
Parameters:
raveId
- RaveID of the user to unblock
listener
- Completion listener
fetchBlockedUsers#
Fetch the list of blocked users.
public void fetchBlockedUsers(RaveUsersManager.RaveUsersListener listener)
Parameters:
listener
- Listener supplying the list of users or error
pushCurrent - Deprecated in 3.0.2#
Pushes any changes to the current user stores in the local cache back to the server.
public void pushCurrent(final RaveCompletionListener listener)
Parameters:
listener
- Listener to call when the push operation is completed
Authentication API#
class: co.ravesocial.sdk.core.RaveAuthentication
Interface - RaveConnectStateListener#
Listener for plugin connect state:
public void onComplete(boolean isConnected, String userId, RaveException exception)
Parameters:
isConnected
- True or false given whether plugin is connected with Rave
userId
- User id of user for social provider (e.g. FB UID)
exception
- Exception if any was encountered or null
Interface - RaveReadinessListener#
Listener for plugin state readiness:
public void onComplete(boolean isReady, RaveException exception)
Parameters:
isReady
- True or false given whether plugin is ready (e.g. connected and userId equals expected UID associated with Rave account)
exception
- Exception if any was encountered or null
Class - RaveAuthentication#
getConnectPlugins#
Get all registered RaveConnectPlugins:
Collection<? extends Object> getConnectPlugins()
Returns: A collection of plugin objects
getConnectPlugin#
Get an implementation of a RaveConnectPlugin:
Object getConnectPlugin(String pluginKeyName)
Parameters:
pluginKeyName
- The KeyName of the plugin
Returns: The plugin object
registerConnectPlugin (built-in)#
Registers an internally implemented RaveConnectPlugin:
void registerConnectPlugin(String pluginKeyName)
Parameters:
pluginKeyName
- The KeyName of the plugin
registerConnectPlugin (external)#
Registers an implementation of a RaveConnectPlugin:
void registerConnectPlugin(RaveConnectPlugin plugin)
Parameters:
plugin
- The plugin to register
loginAsGuest#
Logs in as guest
Will throw an exception if RaveSettings.General.AutoGuestLogin is enabled:
void loginAsGuest(String raveId, RaveCompletionListener listener)
Parameters:
raveId
- The RaveID to use for the new Guest
listener
- Completion listener (see RaveCompletionListener)
loginWith#
Attention
Rather than implementing a fully custom control for connecting your users we suggest as best practice that you instead use your custom UI to wrap one of our connect controllers. Please read Adding a Facebook (or other social provider) button to your App.
Logs in using an authentication provider
void loginWith(String pluginKeyName, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- Completion listener (see RaveCompletionListener)
connectTo#
Attention
Rather than implementing a fully custom control for connecting your users we suggest as best practice that you instead use your custom UI to wrap one of our connect controllers. Please read Adding a Facebook (or other social provider) button to your App.
Connects an existing Rave account using an authentication provider
void connectTo(String pluginKeyName, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- Completion Listener (see RaveCompletionListener)
connectTo#
Note
You’re encouraged to call connectTo instead.
Connects an existing Rave account using an authentication provider
void connectTo(String pluginKeyName, RaveConflictResolutionPolicy policy, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
policy
- The conflict resolution policy to use for this call
listener
- Completion Listener (see RaveCompletionListener)
forceConnectTo#
Connects an existing Rave account using an authentication provider:
void forceConnectTo(String pluginKeyName, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- Completion Listener (see RaveCompletionListener)
disconnectFrom#
Disconnect an existing account from an authentication provider:
void disconnectFrom(String pluginKeyName, RaveCompletionListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- Completion Listener (see RaveCompletionListener)
lastKnownReadinessOf#
Gets the last known readiness state of an authentication provider
boolean lastKnownReadinessOf(String pluginKeyName)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
Returns: true if ready, false if not
checkReadinessOf#
Checks the current readiness state of an authentication provider
void checkReadinessOf(String pluginKeyName, RaveReadinessListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- Completion Listener
getCurrentTokenFrom#
Gets the current token of a specific type from an authentication provider
String getCurrentTokenFrom(String pluginKeyName, RaveConnectPlugin.RaveTokenType tokenType)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
tokenType
- The type of token to get
Returns: The token or null if no token
getCurrentTokenFrom#
Gets the current access token from an authentication provider
String getCurrentTokenFrom(String pluginKeyName)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
Returns: The access token or null if no token
useTokenForRaveUpgradeWith#
Specifies a token to use when upgrading from a previous installation without Rave:
void useTokenForRaveUpgradeWith(String pluginKeyName, String token)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
token
- The token to use
logOut#
Logs the current user out of Rave
Providing a null listener will result in operations such as automatic guest login and session deletion happening asynchronously. To guarantee that a race does not happen with any other authentication actions, it is highly recommended that a listener be set and that no other Rave APIs be called until the listener has called back.
void logOut(RaveCompletionListener listener)
Parameters:
listener
- Completion listener (see RaveCompletionListener)
fetchConnectStateOf#
Fetches the current connect state of an authentication provider
void fetchConnectStateOf(String pluginKeyName, RaveConnectStateListener listener)
Parameters:
pluginKeyName
- The KeyName of the authentication provider plugin
listener
- The connect state listener
fetchThirdPartyInfo#
Fetches third party information for a network:
void fetchThirdPartyInfo(String thirdPartyKey, RaveConnectStateListener listener)
Parameters:
thirdPartyKey
- The third-party key
listener
- The connect state listener
Friends API#
Deprecation Warning
As of v3.13.0, this API is deprecated and planned for removal in a future release. We strongly advise that you adjust your code dependencies to avoid potential disruptions, as continuous updates and support for this API will not be available after its removal.
class: RaveFriendsManager
#
Main API for accessing Rave friends
accessor:
RaveSocial.friendsManager
convenience class:
RaveFriends
friendsListQuery#
Start query for friends list:
public RaveRelationship.ListQueryBuilder<RaveFriend> friendsListQuery(String listKey);
Parameters:
listKey
- Key for the friends list to query
Returns: Reference to a list query builder for filtering friends
updateFriendsList#
Update cached list of friends for given key:
public void updateFriendsList(String listKey, RaveCompletionListener listener);
Parameters:
listKey
- Key identifier for list being updated
listener
- Callback indicating success of operation
removeFriend#
Remove friend from specified list:
public void removeFriend(String listKey, String friendId, RaveCompletionListener listener);
Parameters:
listKey
- Key identifier for list friend is being removed from
friendId
- Rave id for friend being removed
listener
- Callback indicating success of the operation
sendFriendRequest#
Send friend request to another Rave user:
public void sendFriendRequest(RaveUserReference reference, String listKey, RaveCompletionListener listener);
Parameters:
reference
- Reference to user to befriend
listKey
- Identifier for list to send friend request through
listener
- Callback indicating success of the operation
fetchSentFriendRequests#
Fetch list of pending friend requests sent by the current user:
public void fetchSentFriendRequests(String listKey, RaveFriendRequestListener listener);
Parameters:
listKey
- Identifier for the list to query
listener
- Callback providing the list of results or an error
cancelFriendRequest#
Cancel a pending sent friend request:
public void cancelFriendRequest(String listKey, String raveId, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for the list to remove the friend request from
raveId
- Rave id for the user that the request is being canceled for
listener
- Callback indicating success of the operation
fetchReceivedFriendRequests#
Fetch list of pending friend requests sent by the current user:
public void fetchReceivedFriendRequests(String listKey, RaveFriendRequestListener listener);
Parameters:
listKey
- Identifier for the list to query
listener
- Callback providing the list of results or an error
acceptFriendRequest#
Accept received friend rquest:
public void acceptFriendRequest(String listKey, String friendId, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for the list to accept friend request in
friendId
- Rave id for user accepting friend request from
listener
- Callback indicating success of the operation
rejectFriendRequest#
Reject received friend rquest:
public void rejectFriendRequest(String listKey, String raveId, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for the list to accept friend request in
raveId
- Rave id for user accepting friend request from
listener
- Callback indicating success of the operation
Query Recipes#
Now you can filter friends and followers with query builders. For example if you want to find the first ten users alphabetically that have the name “Frank” you would use the following code snippet:
RaveSocial.friendsManager.friendsListQuery("ExampleListKey").orderBy(RaveRelationship.ORDER_BY.REAL_NAME).where(RaveRelationship.WHERE.REAL_NAME).like("Frank%").limit(10).orderBy(RaveRelationship.ORDER_BY.DISPLAY_NAME).get()
Or if you wanted to find the third person with the displayName “BubbleGum” this snippet would serve:
RaveSocial.friendsManager.friendsListQuery("ExampleListKey").where(RaveRelationship.WHERE.DISPLAY_NAME).equals("Frank%").offset(2, 1).get()
interface: RaveRelationship.QueryBuilder
#
A query builder to query lists of relationships
get#
Retrieve the query results from the chain of builder calls:
List<? extends RaveRelationship> get();
Returns: The filtered query results
interface: RaveRelationship.SearchQueryBuilder
#
A query builder providing search features
like#
An SQL standard ‘WHERE field LIKE’ clause:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> like(String pattern);
Parameters:
pattern
- The standard SQL LIKE clause
Returns: A list query builder
equals#
An SQL standard ‘WHERE field ==’ clause:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> equals(String pattern);
Parameters:
pattern
- The stander SQL ‘WHERE field ==’ clause
Returns: A list query builder
interface: RaveRelationship.ListQueryBuilder
#
A query builder providing filtering features
where#
Add a standard SQL ‘WHERE’ clause - May only be used once per field:
RaveRelationship.SearchQueryBuilder<? extends RaveRelationship> where(RaveRelationship.WHERE field);
Parameters:
field
- The field to match on
Returns: A search query builder
offset#
The result starting offset - Only one offset is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> offset(int offset, int limit);
Parameters:
offset
- The offset, starting at 0
limit
- The limit value
Returns: A list query builder
limit#
The result limit - Only one limit is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> limit(int limit);
Parameters:
limit
- The limit value
Returns: A list query builder
orderBy#
The result order - Only one orderBy is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> orderBy(RaveRelationship.ORDER_BY field);
Parameters:
field
- The field to order by
Returns: A list query builder
Followers API#
Deprecation Warning
As of v3.13.0, this API is deprecated and planned for removal in a future release. We strongly advise that you adjust your code dependencies to avoid potential disruptions, as continuous updates and support for this feature will not be available after its removal.
class: RaveFollowersManager
#
Main API for accessing Rave followers
accessor:
RaveSocial.followersManager
convenience class:
RaveFollowers
updateFollowingList#
Update following list for given key:
public void updateFollowingList(String listKey, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for list to update
listener
- Callback indicating success of the operation
followingListQuery#
Query following list for given key:
public RaveRelationship.ListQueryBuilder<RaveFollower> followingListQuery(String listKey);
Parameters:
listKey
- Identifier for the list to query
Returns: List query builder for given list
updateFollowersList#
Update followers list for given key:
public void updateFollowersList(String listKey, RaveCompletionListener listener);
listKey
- Identifier for list to update
listener
- Callback indicating success of the operation
followersListQuery#
Query followers list for given key:
public RaveRelationship.ListQueryBuilder<RaveFollower> followersListQuery(String listKey);
**Parameters:**
listKey
- Identifier for the list to query
Returns: List query builder for given list
followUser#
Follow a user:
public void followUser(String listKey, RaveUserReference reference, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for the list to add the followee to
reference
- Reference to Rave user
listener
- Callback indicating success of the operation
unfollowUser#
Unfollow a user:
public void unfollowUser(String listKey, String raveId, RaveCompletionListener listener);
Parameters:
listKey
- Identifier for the list to remove the followee from
raveId
- Rave id for the user to unfollow
listener
- Callback indicating success of the operation
Query Recipes#
Now you can filter friends and followers with query builders. For example if you want to find the first ten users alphabetically that have the name “Frank” you would use the following code snippet:
RaveSocial.friendsManager.friendsListQuery("ExampleListKey").orderBy(RaveRelationship.ORDER_BY.REAL_NAME).where(RaveRelationship.WHERE.REAL_NAME).like("Frank%").limit(10).orderBy(RaveRelationship.ORDER_BY.DISPLAY_NAME).get()
Or if you wanted to find the third person with the displayName “BubbleGum” this snippet would serve:
RaveSocial.friendsManager.friendsListQuery("ExampleListKey").where(RaveRelationship.WHERE.DISPLAY_NAME).equals("Frank%").offset(2, 1).get()
interface: RaveRelationship.QueryBuilder
#
A query builder to query lists of relationships
get#
Retrieve the query results from the chain of builder calls:
List<? extends RaveRelationship> get();
Returns: The filtered query results
interface: RaveRelationship.SearchQueryBuilder
#
A query builder providing search features
like#
An SQL standard ‘WHERE field LIKE’ clause:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> like(String pattern);
Parameters:
pattern
- The standard SQL LIKE clause
Returns: A list query builder
equals#
An SQL standard ‘WHERE field ==’ clause:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> equals(String pattern);
Parameters:
pattern
- The stander SQL ‘WHERE field ==’ clause
Returns: A list query builder
interface: RaveRelationship.ListQueryBuilder
#
A query builder providing filtering features
where#
Add a standard SQL ‘WHERE’ clause - May only be used once per field:
RaveRelationship.SearchQueryBuilder<? extends RaveRelationship> where(RaveRelationship.WHERE field);
Parameters:
field
- The field to match on
Returns: A search query builder
offset#
The result starting offset - Only one offset is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> offset(int offset, int limit);
Parameters:
offset
- The offset, starting at 0
limit
- The limit value
Returns: A list query builder
limit#
The result limit - Only one limit is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> limit(int limit);
Parameters:
limit
- The limit value
Returns: A list query builder
orderBy#
The result order - Only one orderBy is allowed in a query builder chain:
RaveRelationship.ListQueryBuilder<? extends RaveRelationship> orderBy(RaveRelationship.ORDER_BY field);
Parameters:
field
- The field to order by
Returns: A list query builder
Groups API#
Deprecation Warning
As of v3.13.0, this API is deprecated and planned for removal in a future release. We strongly advise that you adjust your code dependencies to avoid potential disruptions, as continuous updates and support for this API will not be available after its removal.
class: co.ravesocial.sdk.core.RaveGroups
getGroup#
Retrieve a RaveGroup information object with a specified groupAddress parameter.
void getGroup(String groupAddress, RaveGroupListener listener);
Parameters:
groupAddress
- String representing the address of the group info that is to be accessed.
listener
- The listenr containing the group search result.
createGroup#
Create a RaveGroup object and register it with the API service. Currently, all created groups will be public groups and will be scoped to the current application. This method form will create a Group with an auto-generated keyname.
void createGroup(String displayName, RaveGroupListener listner);
Parameters:
displayName
- String containing the name of the group to be displayed to users.
listener
- The listener containing the group search result.
Create a RaveGroup object with a specified key and register it with the API service. Currently, all created groups will be public groups and will be scoped to the current application. This method form will create a Group with keyname specified in the second paramer.
void createGroup(String displayName, String keyname, RaveGroupListener listener);
Parameters:
displayName
- String containing the name of the group to be displayed to users.
keyname
- String used uniquely identify a group. This keyname is used to form the full Group Address used to access any group.
listener
- The listener containing the group search result.
deleteGroup#
Remove the associated group object records from the Rave API service.
void deleteGroup(RaveCompletionListener listener);
Parameters:
listener
- Listener to call when the delete is completed
updateGroup#
Update the RaveGroup object’s current state with Rave API service.
void updateGroup(RaveGroupChanges changes, RaveCompletionListener listener);
Parameters:
changes
- The changes to make to the group.
listener
- Listener to call when the update is completed
getMembers#
Retrieves all members that have joined this group.
List<RaveGroupMember> getGroupMembers();
Returns: A List of RaveGroupMember objects.
addMembers#
A method to add a list of RaveContact ojects to the group.
void addMembers(List<RaveUserReference>users, RaveCompletionListener listener);
Parameters:
members
- An List reference containing a list of referenced RaveUserReference objects to be added to the group for membership.
listener
- Listener to call when the members have been added.
removeMember#
Removes a RaveContact from the membership of the group and update the removal on the Rave API service. Removed contacts can no longer participate in group activity:
void removeMember(RaveGroupMember member, RaveCompletionListener listener);
Parameters:
member
- A RaveGroupMember object representing the user contact to have their membership status removed from this group.
listener
- Listener to call when the members have been removed.
createJoinRequest#
Requests to join the group.:
void createJoinRequest(RaveCompletionListener listener);
Parameters
listener
- Listener to call when the request has been created.
acceptJoinRequest#
Accept a JoinRequest object reference to allow a user to join the group. User that activates this method must be the Group admin.:
void acceptJoinRequest(RaveJoinRequest request, RaveCompletionListener listener);
Parameters:
request
- A JoinRequest object reference representing the request to be granted to the group
listener
- Listener to call when the acceptance is completed
getJoinRequests#
Lists all outstanding requests to join the group. User that activates this method must be the Group admin.
void getJoinRequests(RaveJoinRequestsListener listener);
Parameters:
listener
- A listener containing fetched join requests.
removeJoinRequest#
Reject a JoinRequest object reference to deny a RaveContact user membership to join the group. User that activates this method must be the Group admin.:
void removeJoinRequest(RaveJoinRequest request, RaveCompletionListener listener);
Parameters:
request
- A JoinRequest object reference representing the request to be denied to the group
listener
- Listener to call when the removal is completed
createGroupInvite#
Invites a RaveUser to join the group. User that activates this method must be the Group admin.:
void createGroupInvite(RaveUserReference invitee, RaveCompletionListener listener);
Parameters
invitee
- A RaveUserReference object reference representing the user that is being invited to join the RaveGroup object.
listener
- A listener to call when the group invite has been created.
acceptGroupInvite#
Accept a RaveGroupInvite object reference to confirm a RaveContact user’s invitation to join the group. User that activates this method must be the invitee.:
void acceptGroupInvite(RaveGroupInvite invitation, RaveCompletionListener listener);
Parameters:
invitation
- A RaveGroupInvite object reference representing the invitation to join the group
listener
- Listener to call when the acceptance is completed
getGroupInvites#
Lists all outstanding invitations to the group
void getGroupInvites(String groupAddress, RaveGroupInvitesListener listener);
Paramters:
groupAddress
- The address of the group to fetch invites for.
listener
- A listener containing group invites.
removeGroupInvite#
Removes an invitation join a group
Reject a Group object reference to not accept membership to join a group. User that activates this method must be the invitee.
void removeGroupInvite(RaveGroupInvite request, RaveCompletionListener listener);
Parameters:
request
- A GroupInvite object reference representing the membership invitation that the user wants to reject.
listener
- Listener to call when the removal is completed
isMember#
Checks to see if a RaveContact is a member of a group or role within the group
boolean isMember(RaveUserReference userReference);
Parameters:
userReference
- The RaveUserReference object that is to be checked against the group object for membership or role.
Returns: BOOL answer to whether the specified RaveContact is a member of the group.
blockMembers#
Blocks a list of entities /users from joining a group.
void blockMembers(List<RaveUserReference> users, RaveCompletionListener listener);
Parameters:
users
- An List reference containing a list of referenced RaveUserReference objects to be blocked from requesting or being invited to the group.
listener
- Listener to call when the blocking is completed
unblockMember#
Unblocks a list of entities from joining a group
void unblockMembers(List<RaveUserReference> users, RaveCompletionListener listener);
Parameters:
users
- An List reference containing a list of referenced RaveUserReference objects to be unblocked from requesting or being invited to the group.
listener
- Listener to call when the unblocking is completed
getGroupBlocks#
Lists all entities blocked from joining a group
void getGroupBlocks(RaveUsersListener listener);
Paramters:
listner
- A listener that contains the blocked users for a group.
changeMemberRole#
Changes the role membership of a particular group from one role to another.
void changeMemberRole(RaveGroupMember member, RaveGroupRole role, RaveCompletionListener listener);
Parameters:
member
- The GroupMember object representing a user and current membership in the group.
role
- An Enum value setting the role a member has in the group
listener
- Listener to call when the change is completed
getMember#
returns info about the member, including their role in the group
RaveGroupMember getMember(String uuid);
Parameters:
uuid
- RaveID of the user to fetch.
Returns: A RaveGroupMember object which contains basic information about the user contact this membership info represents, and their current tole and memership status in the group.