Edit in GitHubLog an issue

Java

Syntax

Copied to your clipboard
@NonNull public static String extensionVersion()

Example

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

Kotlin

Example

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

Swift

Syntax

Copied to your clipboard
static var extensionVersion: String

Example

Copied to your clipboard
let extensionVersion = UserProfile.extensionVersion

Objective-C

Syntax

Copied to your clipboard
+ (nonnull NSString*) extensionVersion;

Example

Copied to your clipboard
NSString *extensionVersion = [AEPMobileUserProfile extensionVersion];

Java

Syntax

Copied to your clipboard
public static void getUserAttributes(@NonNull final List<String> keys, @NonNull final 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
}
});

Kotlin

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(listOf("itemsAddedToCart")) {
object : AdobeCallbackWithError<Map<String, Any?>> {
override fun fail(adobeError: AdobeError) {
// your customized code
}
override fun call(value: Map<String, Any?>) {
// your customized code
}
}
}

Swift

Syntax

Copied to your clipboard
static func getUserAttributes(attributeNames: [String], completion: @escaping ([String: Any]?, AEPError) -> Void)
  • completion is the callback function which will be called with user attributes.

Example

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

When the callback is provided, if the operation times out (5s) or an unexpected error occurs, the completion method is called with the appropriate AEPError.

Copied to your clipboard
UserProfile.getUserAttributes(attributeNames: ["itemsAddedToCart"]) { attributes, error in
// your customized code
}

Objective-C

Syntax

Copied to your clipboard
+ (void)getUserAttributesWithAttributeNames:(NSArray<NSString *> * _Nonnull) comletion:^(NSDictionary<NSString *,id> * _Nullable, enum AEPError)

Example

Copied to your clipboard
NSArray *attributes = @[@"itemsAddedToCart"];
[AEPMobileUserProfile getUserAttributesWithAttributeNames:attributes completion:^(NSDictionary<NSString *,id> * _Nullable, enum AEPError) {
// your customized code
}];

Java

Syntax

Copied to your clipboard
@Deprecated
public static void registerExtension()

Example

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

On iOS, the registration occurs by passing UserProfile extension to the MobileCore.registerExtensions API.

Swift

Syntax

Copied to your clipboard
static func registerExtensions(_ extensions: [NSObject.Type],
_ completion: (() -> Void)? = nil)

Example

Copied to your clipboard
import AEPUserProfile
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
MobileCore.registerExtensions([UserProfile.self])
// Override point for customization after application launch.
return true;
}

Objective-C

Syntax

Copied to your clipboard
+ (void) registerExtensions: (NSArray<Class*>* _Nonnull) extensions
completion: (void (^ _Nullable)(void)) completion;

Example

Copied to your clipboard
@import AEPUserProfile;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AEPMobileCore registerExtensions:@[AEPMobileUserProfile.class] completion:nil];
// Override point for customization after application launch.
return YES;
}

Java

Syntax

Copied to your clipboard
@Deprecated
public static void removeUserAttribute(@NonNull final 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");

Java

Syntax

Copied to your clipboard
public static void removeUserAttributes(@NonNull final 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"));

Kotlin

Example

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

Copied to your clipboard
UserProfile.removeUserAttributes(listOf("username", "usertype"))

Swift

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"));

Objective-C

Syntax

Copied to your clipboard
+ (void) removeUserAttributesWithAttributeNames:(NSArray<NSString *> * _Nonnull)

Example

Copied to your clipboard
[AEPMobileUserProfile removeUserAttributesWithAttributeNames:@[@"username", @"usertype"]]

Java

Syntax

Copied to your clipboard
@Deprecated
public static void updateUserAttribute(@NonNull final String attributeName, @Nullable final 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");

Java

Syntax

Copied to your clipboard
public static void updateUserAttributes(@NonNull final 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);

Kotlin

Example

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

Copied to your clipboard
val profileMap = mapOf(
"username" to "Will Smith",
"usertype" to "Actor"
)
UserProfile.updateUserAttributes(profileMap)

Swift

Syntax

Copied to your clipboard
public static func updateUserAttributes(attributeDict: [String: Any])

Example

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

Copied to your clipboard
var profileMap = [AnyHashable: Any]()
profileMap["username"] = "will_smith"
profileMap["usertype"] = "Actor"
UserProfile.updateUserAttributes(attributeDict: profileMap)

Objective-C

Syntax

Copied to your clipboard
+ (void)updateUserAttributesWithAttributeDict:(NSDictionary<NSString *,id> * _Nonnull)

Example

Copied to your clipboard
NSMutableDictionary *profileMap = [NSMutableDictionary dictionary];
[profileMap setObject:@"username" forKey:@"will_smith"];
[profileMap setObject:@"usertype" forKey:@"Actor"];
[AEPMobileUserProfile updateUserAttributesWithAttributeDict:profileMap];
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.