Java
Add the
UserProfile
library to your project using the app's gradle file.Import the
UserProfile
library and any other SDK library in your application's main activity.
Copied to your clipboardimport com.adobe.marketing.mobile.*;
- Add the Mobile Core and Profile extensions to your project using Cocoapods. Add following pods in your
Podfile
:
Copied to your clipboarduse_frameworks!target 'YourTargetApp' dopod 'ACPCore'pod 'ACPUserProfile'end
- Import the UserProfile library.
Objective-C
Copied to your clipboard#import "ACPCore.h"#import "ACPUserProfile.h"
Swift
Copied to your clipboardimport ACPCoreimport 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 clipboardcordova 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 clipboardusing 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 clipboardusing Com.Adobe.Marketing.Mobile;
Java
Required: The setApplication()
method must be called once in the onCreate()
method of your main activity.
- The
UserProfile
extension must be registered with Mobile Core before calling anUserProfile
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 clipboardpublic class MobileApp extends Application {@Overridepublic void onCreate() {super.onCreate();MobileCore.setApplication(this);try {// register other extensionsUserProfile.registerExtension();MobileCore.start(new AdobeCallback () {@Overridepublic void call(Object o) {MobileCore.configureWithAppID("yourAppId");}});} catch (Exception e) {//Log the exception}}}
Swift
Copied to your clipboardfunc 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 clipboardusing 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 updatevoid Start(){ACPUserProfile.registerExtension();ACPCore.Start(HandleStartAdobeCallback);}}
C#
iOS
Register the User Profile extension in your app's FinishedLaunching()
function:
Copied to your clipboardpublic override bool FinishedLaunching(UIApplication app, NSDictionary options){global::Xamarin.Forms.Forms.Init();LoadApplication(new App());ACPUserProfile.RegisterExtension();// start coreACPCore.Start(startCallback);return base.FinishedLaunching(app, options);}private void startCallback(){// set launch configACPCore.ConfigureWithAppID("yourAppId");}
Android
Register the User Profile extension in your app's OnCreate()
function:
Copied to your clipboardprotected override void OnCreate(Bundle savedInstanceState){base.OnCreate(savedInstanceState);global::Xamarin.Forms.Forms.Init(this, savedInstanceState);LoadApplication(new App());ACPUserProfile.RegisterExtension();// start coreACPCore.Start(new CoreStartCompletionCallback());}class CoreStartCompletionCallback : Java.Lang.Object, IAdobeCallback{public void Call(Java.Lang.Object callback){// set launch configACPCore.ConfigureWithAppID("yourAppId");}}