> For the complete documentation index, see [llms.txt](https://docs.movesdk.com/move-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/api-interface/react-native/initialization.md).

# Initialization

The MOVE SDK can be initialized natively or through Javascript. For the first init, the SDK expects to be initialized after user onboarding using Javascript. In this case, Javascript passes the required [MoveAuth](/move-platform/move-sdk-1.x/sdk/models/moveauth.md) and [MoveConfig](/move-platform/move-sdk-1.x/sdk/models/moveconfig.md) objects.

In all future inits, the SDK expects to be initialized natively at app start points (In Appdelegate for iOS, and MainApplication for Android). This is to guarantee that the MOVE SDK is set up and active before the limited time provided by the OS in background wakeups is consumed.&#x20;

The native init will re-use the last authentication and configs objects passed to the SDK from the JS initialization.

### iOS

To initialize the SDK natively, in your Appdelegate:

```objectivec
@implementation AppDelegate
  - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {
    [DolphinSdk initIfPossibleWithLaunchOptions:launchOptions];
    return YES;
  }
@end


```

We strongly recommend against loading UI in background wakeups, but only when it is a foreground wakeup or when the user brings the app to the foreground.&#x20;

* You can distinguish between foreground and background wakeups by checking on the [application state](https://developer.apple.com/documentation/uikit/uiapplication/1623003-applicationstate) in your [willFinishLaunchWithOptions](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application):

```objectivec
if([application applicationState] == UIApplicationStateInactive) {
    [self launchUI];
}
```

* In case it was a background wakeup, you can load the view when user brings app to foreground using [applicationWillEnterForeground](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623076-applicationwillenterforeground/) Appdelegate method:

```objectivec
- (void)applicationWillEnterForeground:(UIApplication *)application {
  if(rootView == nil) {
    [self launchUI];
  }
}
```

### Android

To initialize the SDK natively, in your MainApplication:

```java
import in.dolph.move.sdk.NativeMoveSdkWrapper;

public class MainApplication extends Application implements ReactApplication {
  ....
  private NativeMoveSdkWrapper sdkWrapper;

  @Override
  public void onCreate() {
    super.onCreate();
    ....
    sdkWrapper = NativeMoveSdkWrapper.getInstance(this);
    if (sdkWrapper.isNativeInitializationEnabled()) {
    try {
      sdkWrapper.initNative();
    } catch (Throwable t) {
      // handle init Configuration Errors
    }
    ....
  }
  ....
}
```

### Javascript

```jsx
initialize: (
    config: MoveSdkConfig,
    auth: MoveSdkAuth,
    android: MoveSdkAndroidConfig
  ) => void
```

| **Parameters** |                                                                                                              |                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| config         | [MoveConfig](/move-platform/move-sdk-1.x/sdk/models/moveconfig.md)                                           | The required SDK configurations.                                                                                                                        |
| auth           | [MoveAuth](/move-platform/move-sdk-1.x/sdk/models/moveauth.md)                                               | The user's Auth object.                                                                                                                                 |
| launchOptions  | \[[LaunchOptionsKey ](https://developer.apple.com/documentation/uikit/uiapplication/launchoptionskey): Any]? | The launch options passed in[`willFinishLaunchWithOptions`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application). |

{% hint style="info" %}
The MOVE SDK needs to be initialized before [`willFinishLaunchingWithOptions()`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application) returns in iOS and before [`onCreate()`](https://developer.android.com/reference/android/app/Application#onCreate\(\))returns in Android. This guarantees that all the required SDK components are initialized and ready to handle the triggered system events.&#x20;

In case the app has a login flow, you may want to delay the SDK initialization until the login process is complete. In that case, the app could start the SDK through JavaScript. Once the user is logged in, the SDK should always start before the end of[`onCreate()`](https://developer.android.com/reference/android/app/Application#onCreate\(\))or [`willFinishLaunchingWithOptions()`](https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623032-application)returns.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.movesdk.com/move-platform/move-sdk-1.x/sdk/api-interface/react-native/initialization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
