Edit in GitHubLog an issue
  1. Add the Media extension and its dependencies to your project using the app's Gradle file.
Copied to your clipboard
implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
implementation 'com.adobe.marketing.mobile:analytics:1.+'
implementation 'com.adobe.marketing.mobile:media:2.+'

You can also manually include the libraries. Get .aar libraries from Github.

  1. Import the Media extension in your application's main activity.
Copied to your clipboard
import com.adobe.marketing.mobile.*;
  1. To add the Media library and its dependencies to your project, add the following pods to your Podfile:
Copied to your clipboard
pod 'ACPCore', '~> 2.0'
pod 'ACPAnalytics', '~> 2.0'
pod 'ACPMedia', '~> 2.0'

You can also manually include the libraries. Get .a libraries from Github.

  1. In Xcode project, import Media extension:

Swift

Copied to your clipboard
import ACPMedia

Objective-C

Copied to your clipboard
#import "ACPMedia.h"

JavaScript

  1. Install Media.
Copied to your clipboard
npm install @adobe/react-native-acpmedia

1.1 Link

  • React Native 0.60+

CLI autolink feature links the module while building the app.

  • React Native <= 0.59
Copied to your clipboard
react-native link @adobe/react-native-acpmedia

Note For iOS using cocoapods, run:

Copied to your clipboard
cd ios/ && pod install
  1. Import the extension.
Copied to your clipboard
import {ACPMedia} from '@adobe/react-native-acpmedia';
  1. Get the extension version.
Copied to your clipboard
ACPMedia.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPMedia version: " + version));

Java

To register media with Mobile Core, call the setApplication() method in onCreate() and call set up methods, as shown in this sample:

Copied to your clipboard
import com.adobe.marketing.mobile.*;
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
try {
Media.registerExtension();
Analytics.registerExtension();
Identity.registerExtension();
MobileCore.start(new AdobeCallback () {
@Override
public void call(Object o) {
MobileCore.configureWithAppID("your-launch-app-id");
}
});
} catch (InvalidInitException e) {
}
}
}

Swift

In your app's _:didFinishLaunchingWithOptions function, register the Audience Manager extension with the Mobile Core:

Copied to your clipboard
import ACPCore
import ACPAnalytics
import ACPIdentity
import ACPMedia
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPCore.setLogLevel(.debug)
ACPCore.configure(withAppId: "your-launch-app-id")
ACPAnalytics.registerExtension()
ACPIdentity.registerExtension()
ACPMedia.registerExtension()
ACPCore.start {
}
return true;
}

Objective-C

In your app's application:didFinishLaunchingWithOptions, register Media with Mobile Core:

Copied to your clipboard
#import "ACPCore.h"
#import "ACPAnalytics.h"
#import "ACPIdentity.h"
#import "ACPMedia.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPCore setLogLevel:ACPMobileLogLevelDebug];
[ACPCore configureWithAppId:@"your-launch-app-id"];
[ACPAnalytics registerExtension];
[ACPIdentity registerExtension];
[ACPMedia registerExtension];
[ACPCore start:^{
}];
return YES;
}

JavaScript

When using React Native, registering Media with Mobile Core should be done in native code which is shown under the Android and iOS tabs.

Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.