Edit in GitHubLog an issue

API reference

extensionVersion

The extensionVersion() API returns the version of the Profile extension.

Java

Syntax

Copied to your clipboard
public static String extensionVersion()

Example

Copied to your clipboard
String extensionVersion = UserProfile.extensionVersion();

getUserAttributes

The getUserAttributes() API gets the user profile attributes with the given keys.

Java

Syntax

Copied to your clipboard
public static void getUserAttributes(List<String> keys, AdobeCallback<Map<String, Object>> callback)
  • callback is invoked after the customer attributes are available.

Example

A retail application wants to get the itemsAddedToCart user data when processing checkout.

When AdobeCallbackWithError is provided, if the operation times out (5s) or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Copied to your clipboard
UserProfile.getUserAttributes(Arrays.asList("itemsAddedToCart"), new AdobeCallbackWithError<Map<String, Object>>() {
@Override
public void fail(AdobeError adobeError) {
// your customized code
}
@Override
public void call(Map<String, Object> stringObjectMap) {
// your customized code
}
});

registerExtension

Registers the Profile extension with the Mobile Core extension.

Java

Syntax

Copied to your clipboard
public static void registerExtension()

Example

Copied to your clipboard
import com.adobe.marketing.mobile.UserProfile
...
UserProfile.registerExtension();

removeUserAttribute

Removes the user profile attribute for the given key.

Java

Syntax

Copied to your clipboard
public static void removeUserAttribute(String attributeName)

Example

A retail application wants to remove the itemsAddedToCart user data after the product is purchased.

Copied to your clipboard
UserProfile.removeUserAttribute("itemsAddedToCart");

removeUserAttributes

Removes the user profile attributes for the given keys.

Java

Syntax

Copied to your clipboard
public static void removeUserAttributes(List<String> attributeNames)

Example

You want to remove username, usertype user data when session timeout occurs.

Copied to your clipboard
UserProfile.removeUserAttributes(Arrays.asList("username", "usertype"));

updateUserAttribute

Sets the user profile attributes key and value and allows you to create or update a user profile attribute.

Remember the following information:

  • If the attribute does not exist, it will be created.
  • If the attribute exists, the value will be updated.
  • A null attribute value removes the attribute.

Java

Syntax

Copied to your clipboard
public static void updateUserAttribute(String attributeName,
Object attributeValue)

Example

You want to update username of a user obtained in the log in page:

Copied to your clipboard
UserProfile.updateUserAttribute("username", "Will Smith");

updateUserAttributes

Sets the user profile attributes key and value.

Allows you to create/update a batch of user profile attributes:

  • String, Integer, Boolean, Double, Array, Map are valid type of user profile attributes.
  • Custom objects cannot be saved as a UserProfile attribute.
  • If the attribute does not exist, it is created.
  • If the attribute already exists, the value is updated.
  • A null attribute value will remove the attribute.

Java

Syntax

Copied to your clipboard
public static void updateUserAttributes(Map<String, Object> attributeMap)

Example

You want to update username, usertype of a user obtained in the log in page:

Copied to your clipboard
HashMap<String, Object> profileMap = new HashMap<>();
profileMap.put("username","Will Smith");
profileMap.put("usertype","Actor");
UserProfile.updateUserAttributes(profileMap);
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.