Skip to content

Commit e3e52b9

Browse files
Update SDK installation steps for Android 2.0 integration (#232)
* update extension packages with Android 2.0 builds * no message * installation doc update for Android 2.0 * update docs * Update README.md * update sample app * Update README.md * address review comments
1 parent 1b8e98b commit e3e52b9

File tree

4 files changed

+119
-107
lines changed

4 files changed

+119
-107
lines changed

README.md

Lines changed: 59 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
This repository is a monorepo and contains a collection of React Native modules for Adobe Experience Platform Mobile SDK as listed below. These modules can be found in the [packages](./packages) directory.
99
| Package Name | Latest Version | Native Extension |
1010
| ---- | ---- | ---- |
11-
| [@adobe/react-native-aepcore (required)](./packages/core) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepcore.svg)](https://www.npmjs.com/package/@adobe/react-native-aepcore) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepcore)](https://www.npmjs.com/package/@adobe/react-native-aepcore) | [Mobile Core](https://developer.adobe.com/client-sdks/documentation/mobile-core)
12-
| [@adobe/react-native-aepuserprofile](./packages/userprofile) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepuserprofile.svg)](https://www.npmjs.com/package/@adobe/react-native-aepuserprofile) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepuserprofile)](https://www.npmjs.com/package/@adobe/react-native-aepuserprofile)| [Profile](https://developer.adobe.com/client-sdks/documentation/profile)
13-
| [@adobe/react-native-aepedge](./packages/edge) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedge.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedge) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedge)](https://www.npmjs.com/package/@adobe/react-native-aepedge) | [Edge](https://developer.adobe.com/client-sdks/documentation/edge-network)
14-
| [@adobe/react-native-aepedgeidentity](./packages/edgeidentity) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedgeidentity.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedgeidentity) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedgeidentity)](https://www.npmjs.com/package/@adobe/react-native-aepedgeidentity) |[EdgeIdentity](https://developer.adobe.com/client-sdks/documentation/identity-for-edge-network)
15-
| [@adobe/react-native-aepedgeconsent](./packages/edgeconsent) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedgeconsent.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedgeconsent)](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) | [EdgeConsent](https://developer.adobe.com/client-sdks/documentation/consent-for-edge-network)
16-
| [@adobe/react-native-aepmessaging](./packages/messaging) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepmessaging.svg)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepmessaging)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) | [Messaging](https://developer.adobe.com/client-sdks/documentation/iam/)
17-
| [@adobe/react-native-aepassurance](./packages/assurance) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepassurance.svg)](https://www.npmjs.com/package/@adobe/react-native-aepassurance) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepassurance)](https://www.npmjs.com/package/@adobe/react-native-aepassurance) | [Assurance](https://developer.adobe.com/client-sdks/documentation/platform-assurance-sdk)
18-
| [@adobe/react-native-aepoptimize](./packages/optimize) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepoptimize.svg)](https://www.npmjs.com/package/@adobe/react-native-aepoptimize) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepoptimize) | [Optimize](https://developer.adobe.com/client-sdks/documentation/adobe-journey-optimizer-decisioning)
19-
| [@adobe/react-native-aepplaces](./packages/places) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepplaces.svg)](https://www.npmjs.com/package/@adobe/react-native-aepplaces) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepplaces) | [Places](https://developer.adobe.com/client-sdks/documentation/places)
20-
| [@adobe/react-native-aeptarget](./packages/target) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aeptarget.svg)](https://www.npmjs.com/package/@adobe/react-native-aeptarget) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aeptarget) | [Target](https://developer.adobe.com/client-sdks/documentation/adobe-target)
21-
| [@adobe/react-native-aepcampaignclassic](./packages/campaignclassic) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepcampaignclassic.svg)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepcampaignclassic)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) |[CampaignClassic](https://developer.adobe.com/client-sdks/documentation/adobe-campaign-classic)
22-
23-
> Note: @adobe/react-native-aepassurance <=2.0 is not compatible with @adobe/react-native-aepcore. Please use @adobe/react-native-aepassurance [3.x or above](./packages/assurance#install-npm-package).
11+
| [@adobe/react-native-aepcore (required)](./packages/core) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepcore.svg)](https://www.npmjs.com/package/@adobe/react-native-aepcore) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepcore)](https://www.npmjs.com/package/@adobe/react-native-aepcore) | [Mobile Core](https://developer.adobe.com/client-sdks/documentation/mobile-core)
12+
| [@adobe/react-native-aepuserprofile](./packages/userprofile) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepuserprofile.svg)](https://www.npmjs.com/package/@adobe/react-native-aepuserprofile) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepuserprofile)](https://www.npmjs.com/package/@adobe/react-native-aepuserprofile)| [Profile](https://developer.adobe.com/client-sdks/documentation/profile)
13+
| [@adobe/react-native-aepedge](./packages/edge) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedge.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedge) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedge)](https://www.npmjs.com/package/@adobe/react-native-aepedge) | [Edge](https://developer.adobe.com/client-sdks/documentation/edge-network)
14+
| [@adobe/react-native-aepedgeidentity](./packages/edgeidentity) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedgeidentity.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedgeidentity) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedgeidentity)](https://www.npmjs.com/package/@adobe/react-native-aepedgeidentity) |[EdgeIdentity](https://developer.adobe.com/client-sdks/documentation/identity-for-edge-network)
15+
| [@adobe/react-native-aepedgeconsent](./packages/edgeconsent) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepedgeconsent.svg)](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepedgeconsent)](https://www.npmjs.com/package/@adobe/react-native-aepedgeconsent) | [EdgeConsent](https://developer.adobe.com/client-sdks/documentation/consent-for-edge-network)
16+
| [@adobe/react-native-aepmessaging](./packages/messaging) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepmessaging.svg)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepmessaging)](https://www.npmjs.com/package/@adobe/react-native-aepmessaging) | [Messaging](https://developer.adobe.com/client-sdks/documentation/iam/)
17+
| [@adobe/react-native-aepassurance](./packages/assurance) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepassurance.svg)](https://www.npmjs.com/package/@adobe/react-native-aepassurance) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepassurance)](https://www.npmjs.com/package/@adobe/react-native-aepassurance) | [Assurance](https://developer.adobe.com/client-sdks/documentation/platform-assurance-sdk)
18+
| [@adobe/react-native-aepoptimize](./packages/optimize) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepoptimize.svg)](https://www.npmjs.com/package/@adobe/react-native-aepoptimize) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepoptimize) | [Optimize](https://developer.adobe.com/client-sdks/documentation/adobe-journey-optimizer-decisioning)
19+
| [@adobe/react-native-aepplaces](./packages/places) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepplaces.svg)](https://www.npmjs.com/package/@adobe/react-native-aepplaces) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepplaces) | [Places](https://developer.adobe.com/client-sdks/documentation/places)
20+
| [@adobe/react-native-aeptarget](./packages/target) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aeptarget.svg)](https://www.npmjs.com/package/@adobe/react-native-aeptarget) ![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aeptarget) | [Target](https://developer.adobe.com/client-sdks/documentation/adobe-target)
21+
| [@adobe/react-native-aepcampaignclassic](./packages/campaignclassic) | [![npm version](https://badge.fury.io/js/%40adobe%2Freact-native-aepcampaignclassic.svg)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) [![npm downloads](https://img.shields.io/npm/dm/@adobe/react-native-aepcampaignclassic)](https://www.npmjs.com/package/@adobe/react-native-aepcampaignclassic) |[CampaignClassic](https://developer.adobe.com/client-sdks/documentation/adobe-campaign-classic)
22+
23+
> Warning: Please always use the latest major versions of the above libraries to avoid incompatible issues.
2424
2525
## Requirements
2626

@@ -35,6 +35,7 @@ You need to install Adobe Experience Platform Mobile SDK with [npm](https://www.
3535
> Note: If you are new to React Native, we suggest you follow the [React Native Getting Started](https://reactnative.dev) page before continuing.
3636
3737
### Install AEP npm packages
38+
3839
Adobe Experience Platform Mobile SDK packages can be installed from [npm](https://www.npmjs.com/) command.
3940

4041
> Note: `@adobe/react-native-aepcore` is required to be installed.
@@ -54,52 +55,60 @@ The following code snippet shows for Mobile Core and Edge Network extensions as
5455
...
5556
"dependencies": {
5657
"react-native": "0.64.2",
57-
"@adobe/react-native-aepcore": "^1.0.0", //core is required and includes aepcore, aepsignal, aeplifecycle, aepidentity libraries
58-
"@adobe/react-native-aepedge": "^1.0.0",
59-
"@adobe/react-native-aepedgeidentity": "^1.0.0",
60-
"@adobe/react-native-aepedgeconsent": "^1.0.0",
58+
"@adobe/react-native-aepcore": "^2.0.0", //core is required and includes aepcore, aepsignal, aeplifecycle, aepidentity libraries
59+
"@adobe/react-native-aepedge": "^2.0.0",
60+
"@adobe/react-native-aepedgeidentity": "^2.0.0",
61+
"@adobe/react-native-aepedgeconsent": "^2.0.0",
6162
...
6263
},
6364
```
65+
6466
Inside of the app directory, run
6567

6668
```bash
6769
#if using node package manager
6870
npm install
6971
```
72+
7073
or
74+
7175
```bash
7276
#if using yarn package manager
7377
yarn install
7478
```
7579

7680
##### ios development
81+
7782
For iOS development, after installing the plugins from npm, download the pod dependencies by running the following command:
83+
7884
```bash
7985
cd ios && pod install && cd ..
8086
```
8187

8288
To update native dependencies to latest available versions, run the following command:
89+
8390
```bash
8491
cd ios && pod update && cd ..
8592
```
93+
8694
## Initializing
8795

88-
Initializing the SDK should be done in native code inside your `AppDelegate` (iOS) and `MainApplication` (Android). The following code snippets demonstrate how to install and register the AEP Mobile Core and Edge Network extensions. Documentation on how to initialize each extension can be found in *./packages/{extension}/README.md*.
96+
Initializing the SDK should be done in native code inside your `AppDelegate` (iOS) and `MainApplication` (Android). The following code snippets demonstrate how to install and register the AEP Mobile Core and Edge Network extensions. Documentation on how to initialize each extension can be found in _./packages/{extension}/README.md_.
8997

9098
###### **iOS**
9199

92100
```objective-c
93101
//AppDelegate.h
94102
@import AEPCore;
95103
@import AEPServices;
96-
@import AEPLifecycle;
97-
@import AEPSignal;
98-
@import AEPEdge;
99-
@import AEPEdgeIdentity;
100-
@import AEPEdgeConsent;
104+
@import AEPLifecycle;
105+
@import AEPSignal;
106+
@import AEPEdge;
107+
@import AEPEdgeIdentity;
108+
@import AEPEdgeConsent;
101109
...
102110
```
111+
103112
```objective-c
104113
//AppDelegate.m
105114
...
@@ -108,13 +117,13 @@ Initializing the SDK should be done in native code inside your `AppDelegate` (iO
108117
[AEPMobileCore setLogLevel: AEPLogLevelDebug];
109118
[AEPMobileCore configureWithAppId:@"yourAppID"];
110119
[AEPMobileCore registerExtensions: @[
111-
AEPMobileLifecycle.class,
112-
AEPMobileSignal.class,
113-
AEPMobileEdge.class,
120+
AEPMobileLifecycle.class,
121+
AEPMobileSignal.class,
122+
AEPMobileEdge.class,
114123
AEPMobileEdgeIdentity.class,
115-
AEPMobileEdgeConsent.class,
124+
AEPMobileEdgeConsent.class,
116125
] completion:^{
117-
[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];
126+
[AEPMobileCore lifecycleStart:@{@"contextDataKey": @"contextDataVal"}];
118127
//enable this for Lifecycle. See Note for collecting Lifecycle metrics.
119128
}
120129
];
@@ -125,27 +134,29 @@ Initializing the SDK should be done in native code inside your `AppDelegate` (iO
125134
@end
126135

127136
```
137+
128138
> To enable the Lifecycle metrics, [implement the Lifecycle APIs](./packages/core/README.md#lifecycle)
129139
130140
> Hint : While running iOS application after Adobe Experience Platform SDK installation. If you have build error that states:
131-
> "ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'"
141+
> "ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'"
132142
> This is because Adobe Experience Platform SDK now requires the app uses swift interfaces. Add a dummy .swift file to your project to embed the swift standard libs. See the SampleApp presented in this repo for example.
133143
134144
###### **Android:**
135145
136146
```java
137147
//MainApplication.java
138-
import com.adobe.marketing.mobile.AdobeCallback;
139-
import com.adobe.marketing.mobile.InvalidInitException;
148+
import com.adobe.marketing.mobile.AdobeCallback;
149+
import com.adobe.marketing.mobile.Extension;
140150
import com.adobe.marketing.mobile.LoggingMode;
141151
import com.adobe.marketing.mobile.MobileCore;
142152
import com.adobe.marketing.mobile.Lifecycle;
143-
import com.adobe.marketing.mobile.Signal;
144-
import com.adobe.marketing.mobile.Edge;
145-
import com.adobe.marketing.mobile.edge.consent.Consent;
153+
import com.adobe.marketing.mobile.Signal;
154+
import com.adobe.marketing.mobile.Edge;
155+
import com.adobe.marketing.mobile.edge.consent.Consent;
146156
...
147157
import android.app.Application;
148158
```
159+
149160
```java
150161
...
151162
public class MainApplication extends Application implements ReactApplication {
@@ -156,37 +167,31 @@ public class MainApplication extends Application implements ReactApplication {
156167
...
157168
MobileCore.setApplication(this);
158169
MobileCore.setLogLevel(LoggingMode.DEBUG);
159-
try {
160-
Lifecycle.registerExtension();
161-
Signal.registerExtension();
162-
Edge.registerExtension();
163-
com.adobe.marketing.mobile.edge.identity.Identity.registerExtension();
164-
Consent.registerExtension();
165-
166-
MobileCore.configureWithAppID("yourAppID");
167-
MobileCore.start(new AdobeCallback() {
168-
@Override
169-
public void call(Object o) {
170-
MobileCore.lifecycleStart(null);
171-
//enable this for Lifecycle. See Note for collecting Lifecycle metrics.
172-
}
173-
});
174-
} catch (InvalidInitException e) {
175-
...
176-
}
170+
MobileCore.configureWithAppID("yourAppID");
171+
List<Class<? extends Extension>> extensions = Arrays.asList(
172+
Lifecycle.EXTENSION,
173+
Signal.EXTENSION,
174+
Edge.EXTENSION,
175+
com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,
176+
Consent.EXTENSION);
177+
MobileCore.registerExtensions(extensions, o -> {
178+
Log.d(LOG_TAG, "AEP Mobile SDK is initialized");
179+
MobileCore.lifecycleStart(null);
180+
//enable this for Lifecycle. See Note for collecting Lifecycle metrics.
181+
});
177182
}
178183
}
179184
```
180-
> To enable the Lifecycle metrics, [implement the Lifecycle APIs](./packages/core/README.md#lifecycle)
181185

186+
> To enable the Lifecycle metrics, [implement the Lifecycle APIs](./packages/core/README.md#lifecycle)
182187
183188
## Migration guide
184189

185190
See [migration.md](./docs/migration.md) for guidance on migrating from ACP React Native libraries.
186191

187192
## Contributing
188193

189-
Contributions are welcomed! See [CONTRIBUTING](CONTRIBUTING.md) and [development.md](./docs/development.md) guides for more information.
194+
Contributions are welcomed! See [CONTRIBUTING](CONTRIBUTING.md) and [development.md](./docs/development.md) guides for more information.
190195

191196
## Licensing
192197

apps/AEPSampleApp/android/app/src/main/java/com/aepsampleapp/MainActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
package com.aepsampleapp;
1313

14+
import com.adobe.marketing.mobile.MobileCore;
1415
import com.facebook.react.ReactActivity;
1516
import com.facebook.react.ReactActivityDelegate;
1617
import com.facebook.react.ReactRootView;
@@ -35,6 +36,19 @@ protected ReactActivityDelegate createReactActivityDelegate() {
3536
return new MainActivityDelegate(this, getMainComponentName());
3637
}
3738

39+
@Override
40+
protected void onResume() {
41+
super.onResume();
42+
MobileCore.setApplication(getApplication());
43+
MobileCore.lifecycleStart(null);
44+
}
45+
46+
@Override
47+
protected void onPause() {
48+
super.onPause();
49+
MobileCore.lifecyclePause();
50+
}
51+
3852
public static class MainActivityDelegate extends ReactActivityDelegate {
3953
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
4054
super(activity, mainComponentName);

0 commit comments

Comments
 (0)