Initialization

API Interface / React Native

The MOVE SDK must be initialized natively. For the first init, the SDK expects to be setup after user onboarding using Javascript. In this case, Javascript passes the required MoveAuth and MoveConfig 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.

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:

#import <ReactMoveSDK/MoveSdk.h>
...
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [RCTMoveSdk initIfPossibleWithLaunchOptions:launchOptions];
  return YES;
}

Android

To initialize the SDK natively, in your MainApplication:

import in.dolph.move.sdk.NativeMoveSdkWrapper;
...
public class MainApplication extends Application implements ReactApplication {
	private NativeMoveSdkWrapper sdkWrapper;
	...
	public void onCreate() {
		super.onCreate();
		sdkWrapper = NativeMoveSdkWrapper.getInstance(this);
		sdkWrapper.init(this);
		...
	}
}

Javascript

To setup the SDK in React Native you have to provide MoveSdkAuth, MoveSdkConfig and MoveSdkAndroidConfig:

MoveSdk.setup(
    config: MoveSdkConfig,
    auth: MoveSdkAuth,
    android: MoveSdkAndroidConfig
) => Promise<void>

Last updated

#70: add MoveSdkAndroidConfig model

Change request updated