public class BrazeUser
extends java.lang.Object
Constructor and Description |
---|
BrazeUser(UserCache userCache,
IBrazeManager brazeManager,
java.lang.String userId,
ILocationManager locationManager,
ServerConfigStorageProvider serverConfigStorageProvider)
Internal constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAlias(java.lang.String alias,
java.lang.String label)
Adds an an alias for the current user.
|
boolean |
addToCustomAttributeArray(java.lang.String key,
java.lang.String value)
Adds a String to a custom attribute string array, or creates that array if one doesn't exist.
|
boolean |
addToSubscriptionGroup(java.lang.String subscriptionGroupId)
Adds the user to the subscription group.
|
java.lang.String |
getUserId()
Returns the currently tracked user id.
|
boolean |
incrementCustomUserAttribute(java.lang.String key)
Increments the value of an custom attribute by one.
|
boolean |
incrementCustomUserAttribute(java.lang.String key,
int incrementValue)
Increments the value of an custom attribute by a given amount.
|
boolean |
removeFromCustomAttributeArray(java.lang.String key,
java.lang.String value)
Removes a string element from a custom attribute string array.
|
boolean |
removeFromSubscriptionGroup(java.lang.String subscriptionGroupId)
Removes the user from the subscription group.
|
boolean |
setAttributionData(AttributionData attributionData)
Sets attribution information for the user.
|
boolean |
setAvatarImageUrl(java.lang.String avatarImageUrl)
Sets the Avatar image of the user which will be displayed on the user's profile on the dashboard.
|
boolean |
setCountry(java.lang.String country)
Sets the home country of the user.
|
boolean |
setCustomAttributeArray(java.lang.String key,
java.lang.String[] values)
Sets a String array of custom user attributes.
|
boolean |
setCustomUserAttribute(java.lang.String key,
boolean value)
Sets a boolean custom user attribute.
|
boolean |
setCustomUserAttribute(java.lang.String key,
double value)
Sets a double custom user attribute.
|
boolean |
setCustomUserAttribute(java.lang.String key,
float value)
Sets a float custom user attribute.
|
boolean |
setCustomUserAttribute(java.lang.String key,
int value)
Sets an int custom user attribute.
|
boolean |
setCustomUserAttribute(java.lang.String key,
long value)
Sets a long custom user attribute.
|
boolean |
setCustomUserAttribute(java.lang.String key,
java.lang.String value)
Sets a string custom user attribute.
|
boolean |
setCustomUserAttributeToNow(java.lang.String key)
Sets a custom attribute with the given key to the current time.
|
boolean |
setCustomUserAttributeToSecondsFromEpoch(java.lang.String key,
long secondsFromEpoch)
Sets a custom attribute to the given number of seconds elapsed since the epoch.
|
boolean |
setDateOfBirth(int year,
Month month,
int day)
Sets the date of birth of the user.
|
boolean |
setEmail(java.lang.String email)
Sets the email address of the user.
|
boolean |
setEmailNotificationSubscriptionType(NotificationSubscriptionType emailNotificationSubscriptionType)
Sets whether or not the user should be sent email campaigns.
|
boolean |
setFacebookData(FacebookUser facebookUserData)
Sets the Facebook profile data for this user.
|
boolean |
setFirstName(java.lang.String firstName)
Sets the first name of the user.
|
boolean |
setGender(Gender gender)
Sets the gender for the user.
|
boolean |
setHomeCity(java.lang.String homeCity)
Sets the home city of the user.
|
boolean |
setLanguage(java.lang.String language)
Sets the language of the user.
|
void |
setLastKnownLocation(double latitude,
double longitude,
java.lang.Double altitude,
java.lang.Double accuracy)
Sets the last known location for the user.
|
boolean |
setLastName(java.lang.String lastName)
Sets the last name of the user.
|
void |
setLocationCustomAttribute(java.lang.String key,
double latitude,
double longitude) |
boolean |
setPhoneNumber(java.lang.String phoneNumber)
Sets the phone number of the user.
|
boolean |
setPushNotificationSubscriptionType(NotificationSubscriptionType pushNotificationSubscriptionType)
Sets the push notification subscription status of the user.
|
boolean |
setTwitterData(TwitterUser twitterUserData)
Sets the Twitter data for this user.
|
void |
setUserId(java.lang.String userId)
Internal method.
|
boolean |
unsetCustomUserAttribute(java.lang.String key)
Removes the value associated with the given custom attribute key.
|
void |
unsetLocationCustomAttribute(java.lang.String key) |
public BrazeUser(UserCache userCache, IBrazeManager brazeManager, java.lang.String userId, ILocationManager locationManager, ServerConfigStorageProvider serverConfigStorageProvider)
public boolean addAlias(java.lang.String alias, java.lang.String label)
alias
- An alias for the current user.label
- The label of the alias. Used to differentiate it from other aliases for the user.public boolean setFirstName(java.lang.String firstName)
firstName
- The first name of the user. A null value will unset the first name for this user.public boolean setLastName(java.lang.String lastName)
lastName
- The last name of the user. A null value will unset the last name for this user.public boolean setEmail(java.lang.String email)
ValidationUtils.isValidEmailAddress(java.lang.String)
email
- The email address of the user. A null value will unset the email address for this user.public boolean setGender(Gender gender)
gender
- Gender
enum representing the user's gender.public boolean setDateOfBirth(int year, Month month, int day)
year
- The date of birth year.month
- The date of birth month.day
- The date of birth day of the month.public boolean setCountry(java.lang.String country)
country
- The country of the user. A null value will unset the country for this user.public boolean setHomeCity(java.lang.String homeCity)
homeCity
- The home city of the user. A null value will unset the home city for this user.public boolean setLanguage(java.lang.String language)
language
- The ISO 639-1 language code for the user's language. A null value will unset the language for this user.public boolean setEmailNotificationSubscriptionType(NotificationSubscriptionType emailNotificationSubscriptionType)
emailNotificationSubscriptionType
- NotificationSubscriptionType
enum representing the user's email notifications subscription type.public boolean setPushNotificationSubscriptionType(NotificationSubscriptionType pushNotificationSubscriptionType)
pushNotificationSubscriptionType
- NotificationSubscriptionType
enum representing the user's push notifications subscription type.public boolean addToSubscriptionGroup(java.lang.String subscriptionGroupId)
subscriptionGroupId
- The subscription group ID that the user will be added topublic boolean removeFromSubscriptionGroup(java.lang.String subscriptionGroupId)
subscriptionGroupId
- The subscription group ID that the user will be removed frompublic boolean setPhoneNumber(java.lang.String phoneNumber)
ValidationUtils.isValidPhoneNumber(String)
phoneNumber
- The phone number of the user. A null value will unset the phone number for this user.public boolean setCustomUserAttribute(java.lang.String key, boolean value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
.key
- The identifier of the custom attributevalue
- The boolean value of the custom attributepublic boolean setCustomUserAttribute(java.lang.String key, int value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
.key
- The identifier of the custom attributevalue
- The int value of the custom attributepublic boolean setCustomUserAttribute(java.lang.String key, float value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributevalue
- The float value of the custom attributepublic boolean setCustomUserAttribute(java.lang.String key, long value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributevalue
- The long value of the custom attributepublic boolean setCustomUserAttribute(java.lang.String key, java.lang.String value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributevalue
- The String value of the custom attributepublic boolean setCustomUserAttribute(java.lang.String key, double value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributevalue
- The double value of the custom attributepublic boolean addToCustomAttributeArray(java.lang.String key, java.lang.String value)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attribute arrayvalue
- The String value of the custom attribute to be added to the arraypublic boolean removeFromCustomAttributeArray(java.lang.String key, java.lang.String value)
key
- The identifier of the custom attribute arrayvalue
- The String value of the custom attribute to be removed from the arraypublic boolean setCustomAttributeArray(java.lang.String key, java.lang.String[] values)
CustomAttributeValidationUtils#isValidCustomAttributeKey
To unset a custom attribute array, call unsetCustomUserAttribute(java.lang.String)
with the key used to
set the custom attribute array.key
- The identifier of the custom attribute arrayvalues
- The String[] array containing the custom attributes to be setpublic boolean setCustomUserAttributeToNow(java.lang.String key)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributepublic boolean setCustomUserAttributeToSecondsFromEpoch(java.lang.String key, long secondsFromEpoch)
CustomAttributeValidationUtils#isValidCustomAttributeKey
key
- The identifier of the custom attributesecondsFromEpoch
- number of seconds elapsed since the epochpublic boolean incrementCustomUserAttribute(java.lang.String key)
key
- The identifier of the custom attributepublic boolean incrementCustomUserAttribute(java.lang.String key, int incrementValue)
key
- The identifier of the custom attributeincrementValue
- The amount by which to increment the custom attributepublic boolean unsetCustomUserAttribute(java.lang.String key)
key
- The identifier of the custom attributepublic boolean setFacebookData(FacebookUser facebookUserData)
public boolean setTwitterData(TwitterUser twitterUserData)
public boolean setAttributionData(AttributionData attributionData)
public boolean setAvatarImageUrl(java.lang.String avatarImageUrl)
avatarImageUrl
- The url for user's avatar image. A null value will unset the avatar image url for this user.public java.lang.String getUserId()
public void setLastKnownLocation(double latitude, double longitude, java.lang.Double altitude, java.lang.Double accuracy)
BrazeConfig.Builder.setIsLocationCollectionEnabled(boolean)
set to false
in the `braze.xml` configuration file, so that the only locations being set are by the integrating app. Otherwise, calls to this
method will be contending with automatic location update events.
latitude
- The latitude of the User's location in degrees (valid values are between -90 to 90 degrees)longitude
- The longitude of the User's location (valid values are between -180 to 180 degrees)altitude
- The altitude of the User's location in meters above the WGS 84 reference ellipsoidaccuracy
- The accuracy of the User's location in meterspublic void setLocationCustomAttribute(java.lang.String key, double latitude, double longitude)
public void unsetLocationCustomAttribute(java.lang.String key)
public void setUserId(java.lang.String userId)