Package com.bitheads.braincloud.services
Class PlayerStateService
java.lang.Object
com.bitheads.braincloud.services.PlayerStateService
public class PlayerStateService extends Object
-
Constructor Summary
Constructors Constructor Description PlayerStateService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidclearUserStatus(String statusName, IServerCallback callback)Delete's the specified status Service Name - PlayerState Service Operation - ClearUserStatusvoiddeleteUser(IServerCallback callback)Completely deletes the user record and all data fully owned by the user.voidextendUserStatus(String statusName, int additionalSecs, String details, IServerCallback callback)Stack user's statuses Service Name - PlayerState Service Operation - ClearUserStatusvoidgetAttributes(IServerCallback callback)Retrieve the user's attributes.voidgetUserStatus(String statusName, IServerCallback callback)Get user status Service Name - PlayerState Service Operation - ClearUserStatusvoidlogout(IServerCallback callback)Logs user out of the server.voidreadUserState(IServerCallback callback)Read the state of the currently logged in user.voidremoveAttributes(String[] attributeNames, IServerCallback callback)Remove user's attributes.voidresetUser(IServerCallback callback)This method will delete *most* data for the currently logged in user.voidsetUserStatus(String statusName, int durationSecs, String details, IServerCallback callback)Set timed status for a user Service Name - PlayerState Service Operation - ClearUserStatusvoidupdateAttributes(String jsonAttributes, boolean wipeExisting, IServerCallback callback)Update user's attributes.voidupdateContactEmail(String contactEmail, IServerCallback callback)Update the user's contact email.voidupdateLanguageCode(String languageCode, IServerCallback callback)Update user's attributes.voidupdateName(String name, IServerCallback callback)Deprecated.Use updateUserName instead - removal September 1, 2021voidupdateSummaryFriendData(String jsonFriendSummaryData, IServerCallback callback)Updates the "friend summary data" associated with the logged in user.voidupdateTimeZoneOffset(int timeZoneOffset, IServerCallback callback)Update user's attributes.voidupdateUserName(String name, IServerCallback callback)Sets the user's visible namevoidupdateUserPictureUrl(String pictureUrl, IServerCallback callback)Update User picture URL.
-
Constructor Details
-
PlayerStateService
-
-
Method Details
-
deleteUser
Completely deletes the user record and all data fully owned by the user. After calling this method, the user will need to re-authenticate and create a new profile. This is mostly used for debugging/qa.- Parameters:
callback- The callback handler
-
getAttributes
Retrieve the user's attributes.- Parameters:
callback- The callback handler
-
logout
Logs user out of the server.- Parameters:
callback- The callback handler
-
readUserState
Read the state of the currently logged in user. This method returns a JSON object describing most of the user's data: entities, statistics, level, currency. Apps will typically call this method after authenticating to get an up-to-date view of the user's data.- Parameters:
callback- The callback handler
-
removeAttributes
Remove user's attributes.- Parameters:
attributeNames- Array of attribute names.callback- The callback handler
-
resetUser
This method will delete *most* data for the currently logged in user. Data which is not deleted includes: currency, credentials, and purchase transactions. ResetUser is different from DeleteUser in that the user record will continue to exist after the reset (so the user does not need to re-authenticate).- Parameters:
callback- The callback handler
-
updateAttributes
public void updateAttributes(String jsonAttributes, boolean wipeExisting, IServerCallback callback)Update user's attributes.- Parameters:
jsonAttributes- Single layer json string that is a set of key-value pairswipeExisting- Whether to wipe existing attributes prior to update.callback- The callback handler
-
updateTimeZoneOffset
Update user's attributes.- Parameters:
timeZoneOffset- Whether to wipe existing attributes prior to update.callback- The callback handler
-
updateLanguageCode
Update user's attributes.- Parameters:
languageCode- Whether to wipe existing attributes prior to update.callback- The callback handler
-
updateName
Deprecated.Use updateUserName instead - removal September 1, 2021Sets the user's visible name- Parameters:
name- The name to be pickedcallback- The callback handler
-
updateUserName
Sets the user's visible name- Parameters:
name- The name to be pickedcallback- The callback handler
-
updateSummaryFriendData
Updates the "friend summary data" associated with the logged in user. Some operations will return this summary data. For instance the social leaderboards will return the player's score in the leaderboard along with the friend summary data. Generally this data is used to provide a quick overview of the user without requiring a separate API call to read their public stats or entity data.- Parameters:
jsonFriendSummaryData- A JSON string defining the summary data. For example: { "xp":123, "level":12, "highScore":45123 }callback- The callback handler
-
updateUserPictureUrl
Update User picture URL. Service Name - PlayerState Service Operation - UPDATE_PICTURE_URL- Parameters:
pictureUrl- URL to applycallback- The callback handler
-
updateContactEmail
Update the user's contact email. Note this is unrelated to email authentication. Service Name - PlayerState Service Operation - UPDATE_CONTACT_EMAIL- Parameters:
contactEmail- Updated emailcallback- The method to be invoked when the server response is received
-
clearUserStatus
Delete's the specified status Service Name - PlayerState Service Operation - ClearUserStatus- Parameters:
statusName- Name of the statuscallback- The method to be invoked when the server response is received
-
extendUserStatus
public void extendUserStatus(String statusName, int additionalSecs, String details, IServerCallback callback)Stack user's statuses Service Name - PlayerState Service Operation - ClearUserStatus- Parameters:
statusName- Name of the statusadditionalSecs- Add time to existing expiry time.details- Json String to add additional details.callback- The method to be invoked when the server response is received
-
getUserStatus
Get user status Service Name - PlayerState Service Operation - ClearUserStatus- Parameters:
statusName- Name of the statuscallback- The method to be invoked when the server response is received
-
setUserStatus
public void setUserStatus(String statusName, int durationSecs, String details, IServerCallback callback)Set timed status for a user Service Name - PlayerState Service Operation - ClearUserStatus- Parameters:
statusName- Name of the statusdurationSecs- An active duration.details- Json String to add additional details.callback- The method to be invoked when the server response is received
-