Class PlayerStateService

java.lang.Object
com.bitheads.braincloud.services.PlayerStateService

public class PlayerStateService
extends Object
  • Constructor Details

  • Method Details

    • deleteUser

      public void deleteUser​(IServerCallback callback)
      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

      public void getAttributes​(IServerCallback callback)
      Retrieve the user's attributes.
      Parameters:
      callback - The callback handler
    • logout

      public void logout​(IServerCallback callback)
      Logs user out of the server.
      Parameters:
      callback - The callback handler
    • readUserState

      public void readUserState​(IServerCallback callback)
      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

      public void removeAttributes​(String[] attributeNames, IServerCallback callback)
      Remove user's attributes.
      Parameters:
      attributeNames - Array of attribute names.
      callback - The callback handler
    • resetUser

      public void resetUser​(IServerCallback callback)
      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 pairs
      wipeExisting - Whether to wipe existing attributes prior to update.
      callback - The callback handler
    • updateTimeZoneOffset

      public void updateTimeZoneOffset​(int timeZoneOffset, IServerCallback callback)
      Update user's attributes.
      Parameters:
      timeZoneOffset - Whether to wipe existing attributes prior to update.
      callback - The callback handler
    • updateLanguageCode

      public void updateLanguageCode​(String languageCode, IServerCallback callback)
      Update user's attributes.
      Parameters:
      languageCode - Whether to wipe existing attributes prior to update.
      callback - The callback handler
    • updateName

      public void updateName​(String name, IServerCallback callback)
      Deprecated.
      Use updateUserName instead - removal September 1, 2021
      Sets the user's visible name
      Parameters:
      name - The name to be picked
      callback - The callback handler
    • updateUserName

      public void updateUserName​(String name, IServerCallback callback)
      Sets the user's visible name
      Parameters:
      name - The name to be picked
      callback - The callback handler
    • updateSummaryFriendData

      public void updateSummaryFriendData​(String jsonFriendSummaryData, IServerCallback callback)
      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

      public void updateUserPictureUrl​(String pictureUrl, IServerCallback callback)
      Update User picture URL. Service Name - PlayerState Service Operation - UPDATE_PICTURE_URL
      Parameters:
      pictureUrl - URL to apply
      callback - The callback handler
    • updateContactEmail

      public void updateContactEmail​(String contactEmail, IServerCallback callback)
      Update the user's contact email. Note this is unrelated to email authentication. Service Name - PlayerState Service Operation - UPDATE_CONTACT_EMAIL
      Parameters:
      contactEmail - Updated email
      callback - The method to be invoked when the server response is received
    • clearUserStatus

      public void clearUserStatus​(String statusName, IServerCallback callback)
      Delete's the specified status Service Name - PlayerState Service Operation - ClearUserStatus
      Parameters:
      statusName - Name of the status
      callback - 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 status
      additionalSecs - 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

      public void getUserStatus​(String statusName, IServerCallback callback)
      Get user status Service Name - PlayerState Service Operation - ClearUserStatus
      Parameters:
      statusName - Name of the status
      callback - 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 status
      durationSecs - An active duration.
      details - Json String to add additional details.
      callback - The method to be invoked when the server response is received