The Adobe Experience Platform SDK is available for Apple iOS (includes iOS, iPadOS, and tvOS) via Cocoapods, for Google Android via Gradle, and for various cross-platform platforms such as Cordova, Flutter, React Native, Unity, and Xamarin.
Follow the directions below to include the SDK into your mobile application.
{% hint style="info" %} For iOS and Android projects, the recommended approach to integrating the SDK is to use supported dependency and package managers as listed for each platform such as Maven, Cocoapods, etc. SDKs are also available for download on Github. {% endhint %}
{% tabs %} {% tab title="Android" %}
{% hint style="warning" %} Adobe Experience Platform SDKs for Android supports Android 4.0 (API 14) or later. {% endhint %}
-
Open the mobile property you created earlier in Experience Platform Launch.
-
On your mobile property's details page, click on the Environments tab.
The Environments tab lists the different environments where you can publish.
-
In the row for the Development environment, click on the install package icon (
).
You should see a dialog box similar to the following:
-
On the Mobile Install Instructions dialog box, make sure you are on the Android tab.
-
Follow the instructions for using Gradle with Android.
The necessary dependencies and initialization code can be copied from the dialog box to your mobile application project.
-
For Android, the SDK requires standard network connection permissions in your manifest to send data, collect cellular provider, and record offline tracking calls. To enable these permissions, add the following lines to your AndroidManifest.xml file, located in your app's application project directory:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
{% endtab %}
{% tab title="iOS" %}
{% hint style="warning" %} Adobe Experience Platform SDKs for iOS supports iOS 10 or later. {% endhint %}
{% hint style="success" %}
In order to support the new Apple M1 architecture while maintaining support for existing Intel architecture, the AEP SDKs are now distributed using XCFrameworks.
Please see Release notes and Current SDK Versions for more information on the latest extension versions. {% endhint %}
- Open a previously created and configured Mobile property in Launch, and click on the Environments tab, and then click on the install package icon (
).
- On the Mobile Install Instructions dialog box, select iOS.
- Follow the instructions for using CocoaPods with iOS.
- Under the initialization code, choose Objective C or Swift.
The necessary dependencies and initialization code can be copied from the dialog box to your app project.
You should see a pop-up similar to the following (image below shows iOS):
{% tab title="React Native" %}
Adobe Experience Platform Mobile SDK plugin for React Native supports React Native versions 0.44.0 or later. For the latest installation instructions, see the README
file in the react-native-acpcore
repository.
{% hint style="info" %} For React Native, we recommend that you install Node.js to download packages from npm. For additional instructions on getting started with React Native applications, see this tutorial. {% endhint %} {% endtab %}
{% tab title="Flutter" %}
Adobe Experience Platform Mobile SDK plugin for Flutter supports Flutter versions 1.10.0 or later.
For the latest Flutter installation instructions, see the package install tab. {% endtab %}
{% tab title="Cordova" %}
Adobe Experience Platform Mobile SDK plugins for Cordova supports Cordova versions 9.0.0 or later. For the latest Cordova installation instructions, see the README
file in the cordova-acpcore
repository.
{% hint style="info" %} For Cordova, we recommend that you first install Node.js to download packages from npm. For additional instructions on getting started with Cordova applications, see this guide. {% endhint %}
With Node.js installed, you may install the Cordova framework from terminal using the following statement:
sudo npm install -g cordova
To start using the Adobe Experience Platform Mobile SDK plugin for Cordova, navigate to the directory of your Cordova app and install the plugin(s) using the following statement:
cordova plugin add https://github.com/adobe/cordova-acpcore.git
{% endtab %}
{% tab title="Unity" %}
{% hint style="warning" %} Adobe Experience Platform SDKs plugins for Unity supports Unity versions 2019.3.10f1 or later {% endhint %}
{% hint style="info" %} For the latest Unity installation instructions, see the README file in the unity-acpcore repository. {% endhint %}
To start using the Adobe Experience Platform Mobile SDK for Unity, open your application and import the requisite Unity package(s).
For instance, to add the Mobile Core extension, you may:
- Download ACPCore-0.0.1-Unity.zip
- Unzip
ACPCore-0.0.1-Unity.zip
- Import
ACPCore.unitypackage
via Assets-Import Package {% endtab %}
{% tab title="Xamarin" %}
Adobe Experience Platform Mobile SDK plugins for Xamarin require MonoAndroid 9.0+ and Xamarin.iOS 1.0+. For the latest Xamarin installation instructions, see the README
file in the xamarin-acpcore
repository.
{% hint style="info" %} The Adobe Experience Platform Mobile SDK plugins for Xamarin are packages distributed via nuget. NuGet packages can be added to projects within a Visual Studio solution. The NuGet packages can also be generated locally via the included Makefile located in each of the Xamarin repositories. {% endhint %} {% endtab %} {% endtabs %}
If you cannot access the Mobile Install Instructions dialog box in Experience Platform Launch, complete the following sections to get the Adobe Experience Platform SDK. If you already completed the steps in the Mobile Install Instructions dialog box, no need to complete these steps.
Each extension needs added as a dependency to the mobile application project. The examples below will add the Mobile Core and Profile extensions.
{% tabs %} {% tab title="Android" %}
Add the dependencies to build.gradle for each extension.
implementation 'com.adobe.marketing.mobile:userprofile:1.+'
implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
{% endtab %}
{% tab title="iOS" %}
Add the dependencies to your Podfile for each extension.
use_frameworks!
pod 'ACPUserProfile', '~> 2.0'
pod 'ACPCore', '~> 2.0'
{% endtab %} {% endtabs %}
Each extension needs imported and registered in your mobile application project. Besides Mobile Core, all Adobe Experience Platform SDK extensions provide a registerExtension
API. This API registers the extension with Mobile Core. After an extension is registered, it can dispatch and listen for events. You are required to register each of your extensions before making API calls and failing to do so will lead to undefined behavior.
After you register the extensions, you will want to call the start
API in Core. This step is required to boot up the SDK for event processing. The following code snippets demonstrate how to import and register the Mobile Core and Profile extensions. You will also see Identity, Lifecycle, Signal, and UserProfile imported and registered. These are part of the Mobile Core extension bundle. You will see that logging is turned on in DEBUG mode. Mobile Core is also configured with the AppID. This is the ID that matches the mobile application with the configuration published in Adobe Platform Launch.
{% hint style="info" %}
To find your Environment ID for an environment, in Experience Platform Launch, go to the Environments tab (found in a previously created and configured mobile property) and click on the correspondingicon. Find the Environment File ID at the top and copy it.
{% endhint %}
Formerly known as Marketing Cloud ID (MCID), the Experience Cloud ID (ECID) service provides a cross-channel notion of identity across Experience Cloud solutions and is a prerequisite for most implementations. After importing and configuring Identity below, an Experience Cloud identifier is generated and included on every network hit that is sent to Adobe solutions. Other automatically generated and custom synced identifiers are also sent with each hit.
{% tabs %} {% tab title="Android" %} Add the following initialization code. It may need to be adjusted depending on how your application is structured.
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.Identity;
import com.adobe.marketing.mobile.InvalidInitException;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Signal;
import com.adobe.marketing.mobile.UserProfile;
...
import android.app.Application;
...
public class MainApp extends Application {
...
@Override
public void on Create(){
super.onCreate();
MobileCore.setApplication(this);
MobileCore.setLogLevel(LoggingMode.DEBUG);
...
try {
UserProfile.registerExtension();
Identity.registerExtension();
Lifecycle.registerExtension();
Signal.registerExtension();
MobileCore.start(new AdobeCallback () {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("<your_environment_id_from_Launch>");
}
});
} catch (InvalidInitException e) {
...
}
}
}
{% endtab %}
{% tab title="iOS" %} Add the following initialization code. It may need to be adjusted depending on how your application is structured.
#import "AppDelegate.h"
#import "ACPCore.h"
#import "ACPUserProfile.h"
#import "ACPIdentity.h"
#import "ACPLifecycle.h"
#import "ACPSignal.h"
...
@implementation AppDelegate
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPCore setLogLevel:ACPMobileLogLevelDebug];
[ACPCore configureWithAppId:@"<your_environment_id_from_Launch>"];
...
[ACPUserProfile registerExtension];
[ACPIdentity registerExtension];
[ACPLifecycle registerExtension];
[ACPSignal registerExtension];
const UIApplicationState appState = application.applicationState;
[ACPCore start:^{
// only start lifecycle if the application is not in the background
if (appState != UIApplicationStateBackground) {
[ACPCore lifecycleStart:nil];
}
}];
...
return YES;
}
@end
import ACPCore
import ACPUserProfile
...
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool{
ACPCore.setLogLevel(.debug)
ACPCore.configure(withAppId: "<your_environment_id_from_Launch>")
...
ACPUserProfile.registerExtension()
ACPIdentity.registerExtension()
ACPLifecycle.registerExtension()
ACPSignal.registerExtension()
ACPCore.start {
ACPCore.lifecycleStart(nil)
}
...
return true
}
}
{% endtab %}
{% tab title="React Native" %}
For React Native apps, initialize the SDK using native code in your AppDelegate
and MainApplication
in iOS and Android, respectively.
Initialization code is located in this Github README
.
{% endtab %}
{% tab title="Flutter" %}
For Flutter apps, initialize the SDK using native code in your AppDelegate
and MainApplication
in iOS and Android, respectively.
Initialization code is located in this Github README
.
{% endtab %}
{% tab title="Cordova" %}
For Cordova apps, initialize the SDK using native code in your AppDelegate
and MainApplication
in iOS and Android, respectively.
iOS:
// Import the SDK
#import "ACPCore.h"
#import "ACPLifecycle.h"
#import "ACPIdentity.h"
#import "ACPSignal.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// make sure to set the wrapper type at the beginning of initialization
[ACPCore setWrapperType:ACPMobileWrapperTypeCordova];
//...
[ACPCore configureWithAppId:@"yourAppId"];
[ACPIdentity registerExtension];
[ACPLifecycle registerExtension];
[ACPSignal registerExtension];
// Register any additional extensions
[ACPCore start:nil];
}
Android:
// Import the SDK
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Identity;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.Signal;
import com.adobe.marketing.mobile.WrapperType;
@Override
public void onCreate() {
//...
MobileCore.setApplication(this);
MobileCore.configureWithAppID("yourAppId");
// make sure to set the wrapper type at the beginning of initialization
MobileCore.setWrapperType(WrapperType.CORDOVA);
try {
Identity.registerExtension();
Lifecycle.registerExtension();
Signal.registerExtension();
// Register any additional extensions
} catch (Exception e) {
// handle exception
}
MobileCore.start(null);
}
{% endtab %}
{% tab title="Unity" %}
For Unity apps, initialize the SDK using the following code in the start function of the MainScript
using com.adobe.marketing.mobile;
using using AOT;
public class MainScript : MonoBehaviour
{
[MonoPInvokeCallback(typeof(AdobeStartCallback))]
public static void HandleStartAdobeCallback()
{
ACPCore.ConfigureWithAppID("1423ae38-8385-8963-8693-28375403491d");
}
// Start is called before the first frame update
void Start()
{
if (Application.platform == RuntimePlatform.Android) {
ACPCore.SetApplication();
}
ACPCore.SetLogLevel(ACPCore.ACPMobileLogLevel.VERBOSE);
ACPCore.SetWrapperType();
ACPIdentity.registerExtension();
ACPLifecycle.registerExtension();
ACPSignal.registerExtension();
ACPCore.Start(HandleStartAdobeCallback);
}
}
{% endtab %}
{% tab title="Xamarin" %}
For Xamarin Forms apps, the SDK intialization differs depending on the platform being targetted.
iOS
using Com.Adobe.Marketing.Mobile;
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
// set the wrapper type
ACPCore.SetWrapperType(ACPMobileWrapperType.Xamarin);
// set launch config
ACPCore.ConfigureWithAppID("your-app-id");
// register SDK extensions
ACPIdentity.RegisterExtension();
ACPLifecycle.RegisterExtension();
ACPSignal.RegisterExtension();
// start core
ACPCore.Start(null);
}
Android
using Com.Adobe.Marketing.Mobile;
[Activity(Label = "TestApp", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
// set the wrapper type
ACPCore.SetWrapperType(WrapperType.Xamarin);
// register SDK extensions
ACPCore.Application = this.Application;
ACPIdentity.RegisterExtension();
ACPLifecycle.RegisterExtension();
ACPSignal.RegisterExtension();
// start core
ACPCore.Start(null);
}
{% endtab %} {% endtabs %}
The SDK requires standard network connection permissions in your manifest to send data, collect cellular provider, and record offline tracking calls.
To enable these permissions, add the following lines to your AndroidManifest.xml
file, located in your app's application project directory:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Create a Podfile if you do not already have one:
pod init
If Cocoapods cannot not find the dependencies, you may need to run this command:
pod repo update
Save the Podfile and run the install:
pod install
{% embed url="https://www.youtube.com/watch?v=K99NwR6Y08E" caption="Video: How to use Cocoapods and Gradle with SDK extensions & dependencies" %}
- Visit the SDK community forum to ask questions
- Contact Adobe Experience Cloud customer care for immediate assistance