Skip to content

Commit 38ae671

Browse files
authored
Merge pull request #772 from adobe/main
Reverse merge `main` (3.4.0) into `staging`
2 parents 1d86b0f + 9b70e82 commit 38ae671

File tree

1 file changed

+99
-3
lines changed

1 file changed

+99
-3
lines changed

Documentation/MobileCore/api-reference.md

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ MobileCore.setWrapperType(WrapperType.REACT_NATIVE)
8282
```
8383

8484

85-
#### Initializing MobileCore with Android Application instance
85+
#### Setting Android Application instance
8686

8787
Use the `setApplication` api to pass the Android Application instance to SDK. This allows the SDK to monitor the lifecycle of your Android application.
8888

@@ -113,7 +113,7 @@ class YourApp : Application() {
113113
```
114114

115115

116-
#### Retrieving the registered Application
116+
#### Retrieving the Android Application instance
117117

118118
You can use the `getApplication()` api to get the Android Application instance that was previously set via `MobileCore.setApplication()`
119119

@@ -130,8 +130,104 @@ final Application app = MobileCore.getApplication();
130130
val app = MobileCore.getApplication()
131131
```
132132

133+
#### Initializing the SDK by automatically registering all extensions and enabling Lifecycle data collection
133134

134-
#### Registering extensions and starting the SDK
135+
> [!NOTE]
136+
> API `initialize(String appId)` added since Core 3.3.0
137+
138+
> [!IMPORTANT]
139+
> All Adobe Mobile SDK extensions listed as a dependency in your application are automatically registered when calling `initialize(String appId)`.
140+
>
141+
> Automatic Lifecycle data collection requires **Lifecycle** extension included as an app dependency.
142+
143+
##### Java
144+
145+
```java
146+
public class YourApp extends Application {
147+
148+
@Override
149+
public void onCreate() {
150+
super.onCreate();
151+
152+
MobileCore.initialize(this, YOUR_APP_ID);
153+
154+
// Optionally, if you need a callback:
155+
// MobileCore.initialize(this, YOUR_APP_ID, , new AdobeCallback<Void>() {
156+
// @Override
157+
// public void call(Void result) {
158+
// // SDK initialized.
159+
// }
160+
// });
161+
}
162+
}
163+
```
164+
165+
##### Kotlin
166+
167+
```kotlin
168+
class YourApp : Application() {
169+
override fun onCreate() {
170+
super.onCreate()
171+
172+
MobileCore.initialize(this, YOUR_APP_ID)
173+
174+
// Optionally, if you need a callback:
175+
// MobileCore.initialize(this, YOUR_APP_ID) {
176+
// // SDK initialized.
177+
// }
178+
}
179+
}
180+
```
181+
182+
#### Initializing the SDK by automatically registering all extensions while disabling Lifecycle data collection
183+
184+
> [!NOTE]
185+
> API `initialize(InitOptions options)` added since Core 3.3.0
186+
187+
> [!IMPORTANT]
188+
> All Adobe Mobile SDK extensions listed as a dependency in your application are automatically registered when calling `initialize(InitOptions options)`.
189+
190+
##### Java
191+
192+
```java
193+
public class YourApp extends Application {
194+
195+
@Override
196+
public void onCreate() {
197+
super.onCreate();
198+
199+
InitOptions options = InitOptions.configureWithAppID("YOUR_APP_ID");
200+
options.setLifecycleAutomaticTrackingEnabled(false);
201+
202+
MobileCore.initialize(this, options, new AdobeCallback<Void>() {
203+
@Override
204+
public void call(Void result) {
205+
// SDK initialized.
206+
}
207+
});
208+
}
209+
}
210+
```
211+
212+
##### Kotlin
213+
214+
```kotlin
215+
class YourApp : Application() {
216+
override fun onCreate() {
217+
super.onCreate()
218+
219+
val options = InitOptions.configureWithAppID("YOUR_APP_ID").apply {
220+
lifecycleAutomaticTrackingEnabled = false
221+
}
222+
223+
MobileCore.initialize(this, options) {
224+
// SDK initialized.
225+
}
226+
}
227+
}
228+
```
229+
230+
#### Manually registering extensions and starting the SDK
135231

136232
##### Java
137233

0 commit comments

Comments
 (0)