For initializing the project, you'll need to provide the Workspace ID (earlier App ID) of your MoEngage App.
Getting Workspace ID :Login to your MoEngage account, go to Settings in the left panel of the dashboard. Under General Settings, you will find your Workspace ID. |
Once you get the AppId, go to your AppDelegate
file and call the below initialization method in application:didFinishLaunchingWithOptions:
method:
Note: For swift applications add #import <ReactNativeSegmentMoEngage/MoEngageSegmentReactInitializer.h> in App-Bridging-Header.h file. If you have added the react-native-moengage plugin , follow the doc for initialization.
import MoEngageSDK
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let sdkConfig = MoEngageSDKConfig(appId: "YOUR APPID", dataCenter: DATA_CENTER);
sdkConfig.enableLogs = true
MoEngageSegmentReactInitializer.sharedInstance().initializeDefaultSDKConfig(sdkConfig, andLaunchOptions: launchOptions))
//Rest of the implementation of method
//-------
return true
}
#import <ReactNativeSegmentMoEngage/MoEngageSegmentReactInitializer.h>
#import <MoEngageSDK/MoEngageSDK.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
MoEngageSDKConfig* sdkConfig = [[MoEngageSDKConfig alloc] initWithAppId:@"YOUR APPID" dataCenter: DATA_CENTER];
sdkConfig.enableLogs = true;
[[MoEngageSegmentReactInitializer sharedInstance] initializeDefaultSDKConfig:sdkConfig andLaunchOptions:launchOptions];
return YES;
}
Following details of the different data centers you need to set based on the dashboard hosts
Data Center | Dashboard host |
---|---|
data_center_01 |
dashboard-01.moengage.com |
data_center_02 |
dashboard-02.moengage.com |
data_center_03 |
dashboard-03.moengage.com |
data_center_04 |
dashboard-04.moengage.com |
data_center_05 |
dashboard-05.moengage.com |
Refer to the doc to configure the properties of MoEngageSDKConfig.