BrazeUser

class BrazeUser

Properties

Link copied to clipboard

Returns the currently tracked user id.

Functions

Link copied to clipboard
fun addAlias(alias: String, label: String): Boolean

Adds an an alias for the current user. (alias, label) pairs can exist on one and only one user. If a different user already has this alias or external user id, the alias attempt will be rejected on the server (even if this method returns true).

Link copied to clipboard

Adds a String to a custom attribute string array, or creates that array if one doesn't exist. The key and value parameters are limited to 255 characters in length. Keys and values which are too long will be truncated. Keys can only contain alphanumeric characters and underscores. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Link copied to clipboard
fun addToSubscriptionGroup(subscriptionGroupId: String): Boolean

Adds the user to the subscription group.

Link copied to clipboard

Increments the value of an custom attribute by a given amount. If no amount is given, the by default it will be incremented by 1. Only integer and long custom attributes can be incremented. Attempting to increment a custom attribute that is not an integer or a long will be ignored. If you increment a custom attribute that has not previously been set, a custom attribute will be created and assigned the value of incrementValue. To decrement the value of a custom attribute, use a negative incrementValue.

Link copied to clipboard

Removes a string element from a custom attribute string array.

Link copied to clipboard
fun removeFromSubscriptionGroup(subscriptionGroupId: String): Boolean

Removes the user from the subscription group.

Link copied to clipboard

Sets attribution information for the user. For apps that have an install tracking integration.

Link copied to clipboard
fun setCountry(country: String?): Boolean

Sets the home country of the user. Used to collect information about the user.

Link copied to clipboard
fun setCustomAttribute(key: String, value: Any, merge: Boolean = false): Boolean
Link copied to clipboard

Sets a String array of custom user attributes. This can be any array of key/value pairs and is used to collect extra information about the user. The key and value parameters are limited to 255 characters in length. Keys and values which are too long will be truncated. Keys can only contain alphanumeric characters and underscores. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey To unset a custom attribute array, call .unsetCustomUserAttribute with the key used to set the custom attribute array.

Link copied to clipboard
Link copied to clipboard

Sets a boolean custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. See CustomAttributeValidationUtils.isValidCustomAttributeKey.

Sets a double custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length. Keys which are too long will be truncated. Keys can only contain alphanumeric characters and underscores. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Sets a float custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Sets an int custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey.

Sets a long custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Sets a string custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key and value parameters are limited to 255 characters in length. Keys and values which are too long will be truncated. Keys can only contain alphanumeric characters and underscores. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Sets a JSON custom user attribute. This can be any key/value pair and is used to collect extra information about the user. The key parameter is limited to 255 characters in length. Keys which are too long will be truncated. Keys can only contain alphanumeric characters and underscores. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Link copied to clipboard

Sets a custom attribute with the given key to the current time. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Link copied to clipboard

Sets a custom attribute to the given number of seconds elapsed since the epoch. The key parameter is limited to 255 characters in length and can only contain alphanumeric characters and underscores. Keys which are too long will be truncated. Keys may not be a reserved key. See CustomAttributeValidationUtils.isValidCustomAttributeKey

Link copied to clipboard
fun setDateOfBirth(year: Int, month: Month, day: Int): Boolean

Sets the date of birth of the user. Used to collect information about the user.

Link copied to clipboard
fun setEmail(email: String?): Boolean

Sets the email address of the user. Used to collect information about the user. Provided email addresses must pass email address validation. The validation method used is available in ValidationUtils.isValidEmailAddress

Link copied to clipboard

Sets whether or not the user should be sent email campaigns. Setting it to unsubscribed opts the user out of an email campaign that you create through the Braze dashboard.

Link copied to clipboard
fun setFirstName(firstName: String?): Boolean

Sets the first name of the user. Used to collect information about the user.

Link copied to clipboard
fun setGender(gender: Gender): Boolean

Sets the gender for the user. Used to collect information about the user.

Link copied to clipboard
fun setHomeCity(homeCity: String?): Boolean

Sets the home city of the user. Used to collect information about the user.

Link copied to clipboard
fun setLanguage(language: String?): Boolean

Sets the language of the user. Language Strings should be valid ISO 639-1 language codes. See https://www.loc.gov/standards/iso639-2/php/code_list.php.

Link copied to clipboard
fun setLastKnownLocation(latitude: Double, longitude: Double, altitude: Double? = null, accuracy: Double? = null, verticalAccuracy: Double? = null)

Sets the last known location for the user. Intended for use with com.braze.configuration.BrazeConfig.Builder.setIsLocationCollectionEnabled 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 and longitude are required; altitude and accuracy may be set to null

Link copied to clipboard
fun setLastName(lastName: String?): Boolean

Sets the last name of the user. Used to collect information about the user.

Link copied to clipboard
fun setLocationCustomAttribute(key: String, latitude: Double, longitude: Double)
Link copied to clipboard
fun setPhoneNumber(phoneNumber: String?): Boolean

Sets the phone number of the user. Used to collect information about the user. Provided phone numbers must pass phone number validation. The validation methods used is available in ValidationUtils.isValidPhoneNumber

Link copied to clipboard

Sets the push notification subscription status of the user. Used to collect information about the user.

Link copied to clipboard

Removes the value associated with the given custom attribute key.