Package com.batch.android
Class BatchUserDataEditor
java.lang.Object
com.batch.android.BatchUserDataEditor
Batch User data editor
-
Method Summary
Modifier and TypeMethodDescriptionAdd a tag in the specified collection.Removes all attributes.clearTagCollection
(String collection) Removes all tags from a collection.Removes all tags.removeAttribute
(String key) Removes a custom attribute.
Does nothing if it was not set.Removes a tag from a collection.void
save()
Save all of the pending changes made in that editor.setAttribute
(String key, boolean value) Set a custom user attribute for a key.setAttribute
(String key, double value) Set a custom user attribute for a key.setAttribute
(String key, long value) Set a custom user attribute for a key.setAttribute
(String key, String value) Set a custom user attribute for a key.setAttribute
(String key, URI value) Set a custom user attribute for a key.setAttribute
(String key, Date value) Set a custom user attribute for a key.setAttributionIdentifier
(String attributionID) Set the user attribution identifier.Set the user email.Set the user email marketing subscription state.setIdentifier
(String identifier) Set the user identifier.
Be careful: you should make sure the identifier uniquely identifies a user.setLanguage
(String language) Set the language of this user.
Overrides the detected user language.Set the region of this user.
Overrides the detected user region.
-
Method Details
-
setLanguage
Set the language of this user.
Overrides the detected user language.- Parameters:
language
- lowercase, ISO 639 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setRegion
Set the region of this user.
Overrides the detected user region.- Parameters:
region
- uppercase, ISO 3166 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setIdentifier
Set the user identifier.
Be careful: you should make sure the identifier uniquely identifies a user. When pushing an identifier, all installations with that identifier will get the Push, which can cause some privacy issues if done wrong.- Parameters:
identifier
- Identifier string- Returns:
- This object instance, for method chaining
-
setAttributionIdentifier
Set the user attribution identifier.- Parameters:
attributionID
- A valid uuid lowercase string or null to reset- Returns:
- This object instance, for method chaining
-
setEmail
Set the user email. Note: This method requires to already have a registered identifier for the user or to callBatchUserDataEditor#setIdentifier
method before this one.- Parameters:
email
- Email string- Returns:
- This object instance, for method chaining.
-
setEmailMarketingSubscriptionState
Set the user email marketing subscription state.- Parameters:
state
- State of the subscription- Returns:
- This object instance, for method chaining.
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null. Note that since timezones are not supported, this will typically represent UTC dates.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null or empty. Must be a string not longer than 64 characters. For better results, you should make them upper/lowercase and trim the whitespaces.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom user attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null or empty. Must be a valid URI not longer than 2048 character.- Returns:
- This object instance, for method chaining
-
removeAttribute
Removes a custom attribute.
Does nothing if it was not set.- Parameters:
key
- Attribute key- Returns:
- This object instance, for method chaining
-
clearAttributes
Removes all attributes.- Returns:
- This object instance, for method chaining
-
addTag
Add a tag in the specified collection. If empty, the collection will automatically be created.- Parameters:
collection
- The collection to add the tag to. Cannot be null. Must be a string of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.tag
- The tag to add. Cannot be null or empty. Must be a string no longer than 64 characters.- Returns:
- This object instance, for method chaining
-
removeTag
Removes a tag from a collection. Does nothing if the tag does not exist.- Parameters:
collection
- Collection nametag
- Tag name- Returns:
- This object instance, for method chaining
-
clearTags
Removes all tags.- Returns:
- This object instance, for method chaining
-
clearTagCollection
Removes all tags from a collection. Does nothing if the tag collection does not exist.- Parameters:
collection
- Tag collection.- Returns:
- This object instance, for method chaining
-
save
public void save()Save all of the pending changes made in that editor. Note if Batch is not started, your changes will be enqueue until it start. Once you called "save", you need to get a new editor in order to make further changes.This action cannot be undone.
-