Skip to content

Commit 6c39e9a

Browse files
authored
Merge pull request #422 from CleverTap/develop
Doc Fixes for SDK-3968
2 parents 1a16bfa + 6e4a1dd commit 6c39e9a

File tree

1 file changed

+42
-46
lines changed

1 file changed

+42
-46
lines changed

docs/integration.md

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,21 @@ Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTap-iOS-
3030
2. Add CleverTapPackage to the packages list in MainApplication.java (`android/app/src/[...]/MainApplication.java`)
3131
```java
3232
// ...
33-
33+
3434
// CleverTap imports
35-
import com.clevertap.android.sdk.ActivityLifecycleCallback;
3635
import com.clevertap.react.CleverTapPackage;
37-
import com.clevertap.react.CleverTapRnAPI;
38-
39-
36+
4037
//...
41-
38+
4239
// add CleverTapPackage to react-native package list
43-
@Override
44-
protected List<ReactPackage> getPackages() {
45-
List<ReactPackage> packages = new PackageList(this).getPackages();
46-
// Packages that cannot be autolinked yet can be added manually here, for
47-
// example:
48-
packages.add(new CleverTapPackage());// only needed when not auto-linking
49-
return packages;
50-
51-
}
40+
@Override
41+
protected List<ReactPackage> getPackages() {
42+
List<ReactPackage> packages = new PackageList(this).getPackages();
43+
// Packages that cannot be autolinked yet can be added manually here, for
44+
// example:
45+
packages.add(new CleverTapPackage());// only needed when not auto-linking
46+
return packages;
47+
}
5248
```
5349

5450
3. Initialise Clevertap ReactNative Integration - This adds support for `ClevertapPushNotiificationClicked` from killed state and registers the `ActivityLifecycleCallback`
@@ -60,52 +56,52 @@ Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTap-iOS-
6056
import com.clevertap.android.sdk.CleverTapAPI;
6157
import com.clevertap.android.sdk.CleverTapAPI.LogLevel;
6258
// ...
63-
64-
public class MainApplication implements ReactApplication {
65-
// ...
66-
67-
@Override
68-
public void onCreate() {
69-
CleverTapAPI.setDebugLevel(LogLevel.VERBOSE);
70-
ActivityLifecycleCallback.register(this);
71-
CleverTapRnAPI.initReactNativeIntegration(this);
72-
super.onCreate();
73-
// ...
74-
}
75-
59+
60+
public class MainApplication implements ReactApplication
61+
{
7662
// ...
63+
64+
@Override
65+
public void onCreate() {
66+
CleverTapAPI.setDebugLevel(LogLevel.VERBOSE);
67+
ActivityLifecycleCallback.register(this);
68+
CleverTapRnAPI.initReactNativeIntegration(this);
69+
super.onCreate();
70+
// ...
7771
}
72+
73+
// ...
74+
}
7875
```
7976
8077
<div style="text-align:center; font-size: larger; font-weight: bold;">OR</div>
8178
<br>
8279
83-
8480
- From clevertap-react-native **v3.0.0** onwards developers can make their `Application` class extend `CleverTapApplication` to support out of the box integration. Before **v3.0.0** developers were forced to register activity lifecycle in their `Application` class manually which is being abstract out in `CleverTapApplication` class.
8581
8682
```java
87-
import com.clevertap.react.CleverTapApplication;
88-
import com.clevertap.android.sdk.ActivityLifecycleCallback;
89-
import com.clevertap.android.sdk.CleverTapAPI;
90-
import com.clevertap.android.sdk.CleverTapAPI.LogLevel;
91-
// other imports
92-
93-
public class MainApplication extends CleverTapApplication
83+
import com.clevertap.react.CleverTapApplication;
84+
import com.clevertap.android.sdk.ActivityLifecycleCallback;
85+
import com.clevertap.android.sdk.CleverTapAPI;
86+
import com.clevertap.android.sdk.CleverTapAPI.LogLevel;
87+
// other imports
88+
89+
public class MainApplication extends CleverTapApplication
9490
implements ActivityLifecycleCallbacks, ReactApplication
95-
{
91+
{
9692
// ...
9793
@Override
98-
public void onCreate() {
99-
CleverTapAPI.setDebugLevel(LogLevel.VERBOSE);
100-
ActivityLifecycleCallback.register(this); // Not required for v3.0.0+
101-
super.onCreate();
102-
// ...
103-
}
104-
}
94+
public void onCreate() {
95+
CleverTapAPI.setDebugLevel(LogLevel.VERBOSE);
96+
ActivityLifecycleCallback.register(this); // Not required for v3.0.0+
97+
super.onCreate();
98+
// ...
99+
}
100+
}
105101
```
106102
4. <a name="step4"></a> Optionally override onCreate in MainActivity.java to notify CleverTap of a launch deep link (`android/app/src/[...]/MainActivity.java`)
107103
```java
108-
import com.clevertap.react.CleverTapModule;
104+
import com.clevertap.react.CleverTapRnAPI;
109105
import android.os.Bundle;
110106
111107
@@ -115,7 +111,7 @@ Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTap-iOS-
115111
@Override
116112
protected void onCreate(Bundle savedInstanceState) {
117113
super.onCreate(savedInstanceState);
118-
CleverTapRnAPI.setInitialUri(getIntent().getData());
114+
CleverTapRnAPI.setInitialUri(getIntent().getData()); // From v3.0.0+
119115
}
120116
121117
// ...

0 commit comments

Comments
 (0)