Edit in GitHubLog an issue

Java

  1. Add the UserProfile library to your project using the app's gradle file.

  2. Import the UserProfile library and any other SDK library in your application's main activity.

Copied to your clipboard
import com.adobe.marketing.mobile.*;
  1. Add the Mobile Core and Profile extensions to your project using Cocoapods. Add following pods in your Podfile:
Copied to your clipboard
use_frameworks!
target 'YourTargetApp' do
pod 'ACPCore'
pod 'ACPUserProfile'
end
  1. Import the UserProfile library.

Objective-C

Copied to your clipboard
#import "ACPCore.h"
#import "ACPUserProfile.h"

Swift

Copied to your clipboard
import ACPCore
import ACPUserProfile

Cordova

After creating your Cordova app and adding the Android and iOS platforms, the UserProfile extension for Cordova can be added with this command:

Copied to your clipboard
cordova plugin add https://github.com/adobe/cordova-acpuserprofile.git

C#

After importing the ACPUserProfile.unitypackage, the UserProfile extension for Unity can be added with following code in the MainScript

Copied to your clipboard
using com.adobe.marketing.mobile;

C#

After adding the iOS ACPUserProfile NuGet package or the Android ACPUserProfile NuGet package, the UserProfile extension can be added by this import statement

Copied to your clipboard
using Com.Adobe.Marketing.Mobile;

Java

Required: The setApplication() method must be called once in the onCreate() method of your main activity.

  1. The UserProfile extension must be registered with Mobile Core before calling an UserProfile API.

This can be done after calling setApplication() in the onCreate() method. Here is a code sample, which calls these set up methods:

Copied to your clipboard
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
try {
// register other extensions
UserProfile.registerExtension();
MobileCore.start(new AdobeCallback () {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("yourAppId");
}
});
} catch (Exception e) {
//Log the exception
}
}
}

Swift

Copied to your clipboard
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPCore.configure(withAppId: "yourAppId")
ACPUserProfile.registerExtension()
ACPCore.start(nil)
// Override point for customization after application launch.
return true;
}

Objective-C

Copied to your clipboard
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPUserProfile registerExtension];
// Override point for customization after application launch.
return YES;
}

JavaScript

When using React Native, register Profile with Mobile Core in native code as shown on the Android and iOS tabs.

Flutter

When using Flutter, register Profile with Mobile Core in native code as shown on the Android and iOS tabs.

Cordova

When using Cordova, register Profile with Mobile Core in native code as shown on the Android and iOS tabs.

C#

Register the extension in the start() function:

Copied to your clipboard
using com.adobe.marketing.mobile;
using using AOT;
public class MainScript : MonoBehaviour
{
[MonoPInvokeCallback(typeof(AdobeStartCallback))]
public static void HandleStartAdobeCallback()
{
ACPCore.ConfigureWithAppID("yourAppId");
}
// Start is called before the first frame update
void Start()
{
ACPUserProfile.registerExtension();
ACPCore.Start(HandleStartAdobeCallback);
}
}

C#

iOS

Register the User Profile extension in your app's FinishedLaunching() function:

Copied to your clipboard
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
ACPUserProfile.RegisterExtension();
// start core
ACPCore.Start(startCallback);
return base.FinishedLaunching(app, options);
}
private void startCallback()
{
// set launch config
ACPCore.ConfigureWithAppID("yourAppId");
}

Android

Register the User Profile extension in your app's OnCreate() function:

Copied to your clipboard
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
ACPUserProfile.RegisterExtension();
// start core
ACPCore.Start(new CoreStartCompletionCallback());
}
class CoreStartCompletionCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object callback)
{
// set launch config
ACPCore.ConfigureWithAppID("yourAppId");
}
}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.