Add the required dependencies to your project by including them in the app's Gradle file.
Copied to your clipboardimplementation(platform("com.adobe.marketing.mobile:sdk-bom:3.+"))implementation("com.adobe.marketing.mobile:core")implementation("com.adobe.marketing.mobile:identity")implementation("com.adobe.marketing.mobile:target")
Using dynamic dependency versions is not recommended for production apps. Please read the managing Gradle dependencies guide for more information.
Add the required dependencies to your project by including them in the app's Gradle file.
Copied to your clipboardimplementation platform('com.adobe.marketing.mobile:sdk-bom:3.+')implementation 'com.adobe.marketing.mobile:core'implementation 'com.adobe.marketing.mobile:identity'implementation 'com.adobe.marketing.mobile:target'
Using dynamic dependency versions is not recommended for production apps. Please read the managing Gradle dependencies guide for more information.
Add the required dependencies to your project using CocoaPods. Add following pods in your Podfile
:
Copied to your clipboarduse_frameworks!target 'YourTargetApp' dopod 'AEPCore','~>5.0'pod 'AEPIdentity','~>5.0'pod 'AEPTarget','~>5.0'end
Java
Syntax
Copied to your clipboardpublic TargetOrder(final String id, final double total, final List<String> purchasedProductIds)
Example
Copied to your clipboardList<String> purchasedProductIds = new ArrayList<String>();purchasedProductIds.add("34");purchasedProductIds.add("125");TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);
Swift
Syntax
Copied to your clipboardpublic init(id: String, total: Double = 0, purchasedProductIds: [String]? = nil)
Example
Copied to your clipboardlet order = TargetOrder(id: "id1", total: 1.0, purchasedProductIds: ["ppId1"])
Objective-C
Syntax
Copied to your clipboard- (nonnull instancetype) initWithId: (nonnull NSString*) id total: (double) total purchasedProductIds: (nullable NSArray<NSString*>*) purchasedProductIds;
Example
Copied to your clipboardAEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"id1" total:1.0 purchasedProductIds:@[@"ppId1"]];
Java
Syntax
Copied to your clipboardpublic TargetProduct(final String id, final String categoryId)
Example
Copied to your clipboardTargetProduct targetProduct = new TargetProduct("123", "Books");
Swift
Syntax
Copied to your clipboardpublic init(productId: String, categoryId: String? = nil)
Example
Copied to your clipboardlet product = TargetProduct(productId: "pId1", categoryId: "cId1")
Objective-C
Syntax
Copied to your clipboard- (nonnull instancetype) initWithProductId:(nonnull NSString*) productId categoryId:(nullable NSString*) categoryId;
Example
Copied to your clipboardAEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"pId1" categoryId:@"cId1"];
Java
Syntax
Copied to your clipboardTargetParameters targetParameters = new TargetParameters.Builder().parameters(new HashMap<String, String>()).profileParameters(new HashMap<String, String>()).product(new TargetProduct("productId", "productCategoryId")).order(new TargetOrder("orderId", 0.0, new ArrayList<String>())).build();
Example
Copied to your clipboardList<String> purchasedProductIds = new ArrayList<String>();purchasedProductIds.add("34");purchasedProductIds.add("125");TargetOrder targetOrder = new TargetOrder("123", 567.89, purchasedProductIds);TargetProduct targetProduct = new TargetProduct("123", "Books");Map<String, String> mboxParameters = new HashMap<String, String>();mboxParameters1.put("status", "platinum");Map<String, String> profileParameters = new HashMap<String, String>();profileParameters1.put("gender", "male");TargetParameters targetParameters = new TargetParameters.Builder().parameters(mboxParameters).profileParameters(profileParameters).product(targetProduct).order(targetOrder).build();
Swift
Syntax
Copied to your clipboardpublic init(parameters: [String: String]? = nil, profileParameters: [String: String]? = nil, order: TargetOrder? = nil, product: TargetProduct? = nil)
Example
Copied to your clipboardlet mboxParameters = ["status": "Platinum"]let profileParameters = ["gender": "female"]let order = TargetOrder(id: "id1", total: 1.0, purchasedProductIds: ["ppId1"])let product = TargetProduct(productId: "pId1", categoryId: "cId1")let targetParameters = TargetParameters(parameters: mboxParameters, profileParameters: profileParameters, order: order, product: product))
Objective-C
Syntax
Copied to your clipboard- (nonnull instancetype) initWithParameters:(nullable NSDictionary<NSString*, NSString*>*) parameters profileParameters:(nullable NSDictionary<NSString*, NSString*>*) profileParameters order:(nullable AEPTargetOrder*) order product:(nullable AEPTargetProduct*) product;
Example
Copied to your clipboardNSDictionary *mboxParameters = @{@"status":@"Platinum"};NSDictionary *profileParameters = @{@"gender":@"female"};AEPTargetProduct *product =[[AEPTargetProduct alloc] initWithProductId:@"pId1" categoryId:@"cId1"];AEPTargetOrder *order = [[AEPTargetOrder alloc] initWithId:@"id1" total:1.0 purchasedProductIds:@[@"ppId1"]];AEPTargetParameters * targetParams = [[AEPTargetParameters alloc] initWithParameters:mboxParameters profileParameters:profileParameters order:order product:product];
On Android, when the application is launched as a result of a deep link, the Mobile Core's collectLaunchInfo API is internally invoked, and the Target activity and deep link information is extracted from the Intent extras.
The SDK can only collect information from the launching Activity if setApplication has been called. Setting the Application is only necessary on an Activity that is also an entry point for your application. However, setting the Application on each Activity has no negative impact and ensures that the SDK always has the necessary reference to your Application. We recommend that you call setApplication
API in each of your Activities.
On iOS, the Mobile Core's collectLaunchInfo API can be invoked with the Target preview deep link as shown below:
Swift
Example
Copied to your clipboardMobileCore.collectLaunchInfo(["adb_deeplink" : "com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"])
Objective-C
Example
Copied to your clipboard[AEPMobileCore collectLaunchInfo:@{@"adb_deeplink" : @"com.adobe.targetpreview://app.adobetarget.com?at_preview_token=tokenFromTarget"}];