### Install Pods Source: https://docs.leanplum.com/reference/ios-setup Execute the installation command to integrate the SDK into your project. ```powershell pod install ``` -------------------------------- ### Android MainApplication Setup Source: https://docs.leanplum.com/reference/react-native-setup Add these lines to your Android MainApplication.java file for Leanplum SDK setup, including context and lifecycle callbacks. ```java import com.leanplum.Leanplum; import com.leanplum.LeanplumActivityHelper; ... public class MainApplication extends Application implements ReactApplication { ... @Override public void onCreate() { super.onCreate(); ... Leanplum.setApplicationContext(this); Parser.parseVariables(this); // For session lifecyle tracking. LeanplumActivityHelper.enableLifecycleCallbacks(this); } ... } ``` -------------------------------- ### Install Native Dependencies for iOS Source: https://docs.leanplum.com/reference/react-native-setup After installing the SDK via NPM, run this command in the 'ios' directory to install native dependencies. ```shell cd ios && pod install ``` -------------------------------- ### Start SDK Source: https://docs.leanplum.com/changelog/leanplum-ios-sdk-300-changes Updated parameter labels for initializing the SDK. ```swift Leanplum.start(withUserId: "user1234") ``` ```swift Leanplum.start(userId: "user1234") ``` ```swift Leanplum.start(userAttributes: ["gender":"Female", "age": 29]) ``` ```swift Leanplum.start(attributes: ["gender":"Female", "age": 29]) ``` -------------------------------- ### Initialize In-App Message Support in Unity Editor Source: https://docs.leanplum.com/reference/unity-in-app-messages Enable performing actions and register default action definitions within the `LeanplumWrapper.cs` before Leanplum Start. This setup is specific to the Unity Editor environment. ```csharp #if UNITY_EDITOR EditorMessageTemplates.DefineConfirm(); EditorMessageTemplates.DefineOpenURL(); EditorMessageTemplates.DefineGenericDefinition(); LeanplumNative.ShouldPerformActions(true); Leanplum.SetIncludeDefaultsInDevelopmentMode(true); #endif ``` -------------------------------- ### Install iOS SDK Pods Source: https://docs.leanplum.com/docs/segment-integration-android Install all the dependencies defined in your Podfile, including the LeanplumSegment pod, by running this command in your project's terminal. ```bash $ pod install ``` -------------------------------- ### Install Leanplum SDK via NPM Source: https://docs.leanplum.com/reference/javascript-setup Run this command in your project terminal to install the Leanplum SDK package. ```shell npm install leanplum-sdk ``` -------------------------------- ### Start Response Source: https://docs.leanplum.com/changelog/leanplum-ios-sdk-300-changes Simplified closure syntax for the start response handler. ```swift Leanplum.onStartResponse { (success:Bool) in // Insert code here. } ``` ```swift Leanplum.onStartResponse { (success) in // Insert code here. } ``` -------------------------------- ### Handle all variables and files ready Source: https://docs.leanplum.com/docs/callbacks Executes after start or forceContentUpdate when all variables and files have finished updating/downloading. ```Swift // Add a callback. Leanplum.onVariablesChangedAndNoDownloadsPending { () in // Insert code here. } // Or, add a responder to be executed as a callback. Leanplum.addVariablesChangedAndNoDownloadsPendingResponder(self, with: #selector(self.customResponder)) func customResponder() { // Insert code here. } ``` ```Objective-C // Add a callback. [Leanplum onVariablesChangedAndNoDownloadsPending:^() { goldStarImage = [UIImage imageWithContentsOfFile:[goldStar fileValue]]; }]; // Or, add a responder to be executed as a callback. [Leanplum addVariablesChangedAndNoDownloadsPendingResponder:self withSelector:@selector(customResponder)]; - (void)customResponder { // Insert code here. } ``` ```Java // Add a callback. Leanplum.addVariablesChangedAndNoDownloadsPendingHandler(new VariablesChangedCallback() { @Override public void variablesChanged() { // Insert code here. } }); ``` ```C# // Add a callback. Leanplum.VariablesChangedAndNoDownloadsPending += delegate { // Insert code here. }; ``` ```React Native Leanplum.onVariablesChangedAndNoDownloadsPending(() => { console.log('onVariablesChangedAndNoDownloadsPending'); }); ``` -------------------------------- ### Example: Show Message Using ShouldDisplayMessage Source: https://docs.leanplum.com/changelog/unity-sdk-500 An example of how to use the `Leanplum.ShouldDisplayMessage` method to always show an incoming in-app message. This is a basic implementation of the `ShouldDisplayMessageHandler` delegate. ```csharp Leanplum.ShouldDisplayMessage((context) => { return MessageDisplayChoice.Show(); }); ``` -------------------------------- ### Handle file readiness Source: https://docs.leanplum.com/docs/callbacks Executes after start or forceContentUpdate when a specific file has changed. ```Swift //Define the variable and set the name and value using the Var class var goldstarImage = Var(name: "goldStar", file: "gold_star.png") goldStar.onFileReady { () in goldStarImage = UIImage.init(contentsOfFile: (goldStar.fileValue())!) } ``` ```Objective-C // Define the file variable with the correct macro. DEFINE_VAR_FILE(goldStar, @"gold_star.png"); [goldStar onFileReady:^() { goldStarImage = [UIImage imageWithContentsOfFile:[goldStar fileValue]]; }]; ``` ```Java // Define the file variable with defineAsset. Var kitten = Var.defineAsset("kitten", "kitten.jpg"); kitten.addFileReadyHandler(new VariableCallback() { @Override public void handle(Var variable) { // Insert code here. } }); ``` -------------------------------- ### Initialize CocoaPods Source: https://docs.leanplum.com/reference/ios-setup Run these commands in your terminal to install CocoaPods and initialize your project's Podfile. ```powershell sudo gem install cocoapods pod init open -a Xcode Podfile ``` -------------------------------- ### Initialize mParticle in didFinishLaunchingWithOptions Source: https://docs.leanplum.com/docs/mparticle-sdk Initialization call for the mParticle SDK, which triggers the Leanplum start. ```objective-c [[MParticle sharedInstance] startWithKey:@"KEY_GOES_HERE" secret:@"SECRET_GOES_HERE"]; ``` -------------------------------- ### Example Postback URL Template Source: https://docs.leanplum.com/reference/post_api-action-addpostback This is an example URL template for the postbackUrl parameter. Ensure your URL is URL-encoded before posting to avoid request failures. Keys can be customized, but values in curly braces must match exactly. ```http https://api.service.com/v1/example?message_id={{Message ID}}&event={{Message event}}&device_id={{Device ID}}&user_id={{User ID}}&time={{Trigger time}}&channel={{Message channel}}&template_name={{Template name}}¶meters={{Parameters}} ``` -------------------------------- ### Unity (C#): Add Start Response Callback Source: https://docs.leanplum.com/docs/callbacks This C# callback for Unity executes after Leanplum's start method completes. Use it to synchronize data and ensure variables are available before proceeding. ```csharp // Add a callback. Leanplum.Started += delegate(bool success) { // Insert code here. }; Leanplum.Start(); ``` -------------------------------- ### Java: Add Start Response Handler Source: https://docs.leanplum.com/docs/callbacks Implement this Java callback to run code after Leanplum's start method has finished. It ensures that variables and files are ready before subsequent operations. ```java // Add a new callback. Leanplum.addStartResponseHandler(new StartCallback() { @Override public void onResponse(boolean b) { // Insert code here. } }); ``` -------------------------------- ### Handle all variable changes Source: https://docs.leanplum.com/docs/callbacks Executes after start or forceContentUpdate if any variable has changed. Does not wait for file downloads. ```Swift Leanplum.onVariablesChanged { () in // Insert code here. } ``` ```Objective-C [Leanplum onVariablesChanged:^() { // Insert code here. }]; ``` ```Java Leanplum.addVariablesChangedHandler(new VariablesChangedCallback() { @Override public void variablesChanged() { // Insert code here. } }); ``` ```Unity (C#) Leanplum.VariablesChanged += delegate { // Insert code here. }; ``` ```JavaScript Leanplum.addVariablesChangedHandler(function(success){ // Insert code here. }); ``` ```React Native const func = () => {}; Leanplum.onVariablesChanged(func); ``` -------------------------------- ### GET Request Example Source: https://docs.leanplum.com/reference/making-requests Use GET requests for small API calls. Ensure all URL parameters are properly URL encoded. URLs have a maximum length of 2,083 characters. ```http https://api.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&apiVersion=1.0.6&userId=USER_ID&action=setUserAttributes&userAttributes={"Interests":["Technology","Music"]} ``` ```http https://api.leanplum.com/api?appId=APP_ID&clientKey=CLIENT_KEY&apiVersion=1.0.6&userId=USER_ID&action=setUserAttributes&userAttributes=%7B%27Interests%27%3A+%5B%27Technology%27%2C+%27Music%27%5D%7D ``` -------------------------------- ### iOS Push Notification Setup Source: https://docs.leanplum.com/reference/unreal Guides for setting up push notification support on iOS, including registering for remote notifications. ```APIDOC ## RegisterForRemoteNotifications API (iOS) ### Description Registers the device with the iOS framework to receive remote notifications (alerts, badges, sounds). This should be called after `Leanplum.start()`. ### Method UFUNCTION(BlueprintCallable) static void RegisterForRemoteNotifications(); ### Endpoint N/A (SDK function) ### Parameters None ### Request Example ```cpp LeanplumSDK::RegisterForRemoteNotifications(); ``` ### Response N/A (SDK function) ``` -------------------------------- ### Parse JSON and Get First Element Source: https://docs.leanplum.com/docs/functions The `parsejson()` function converts a JSON string into a JSON object. This example demonstrates parsing a user attribute and retrieving its first element. ```jinja2 User attribute ExampleList = ["ItemA","ItemB","ItemC"] {{ parsejson(userAttribute['ExampleList]) | first }} outputs 'ItemA' ``` -------------------------------- ### POST /api?action=startCampaign Source: https://docs.leanplum.com/reference/post_api-action-startcampaign Activates a campaign for a specific user or device. Requires development API clientKey. ```APIDOC ## POST /api?action=startCampaign ### Description Activates a campaign for one device or user. If `deviceId` is provided, actions are sent to that device; if only `userId` is provided, actions are sent to all devices of that user. ### Method POST ### Endpoint /api?action=startCampaign ### Parameters #### Request Body - **appId** (string) - Required - The application ID. - **clientKey** (string) - Required - The Development key for your Leanplum App. - **apiVersion** (string) - Required - The version of the Leanplum API (e.g., 1.0.6). - **userId** (string) - Required - The current user ID. - **campaignId** (integer) - Required - The ID of the campaign. - **deviceId** (string) - Optional - A unique ID for the device targeted by the request. - **values** (object) - Optional - A JSON object of key-value pairs to override template variables. - **devMode** (boolean) - Optional - Whether the user is in Development Mode. Default: false. - **createDisposition** (string) - Optional - Policy for user creation: 'CreateIfNeeded' or 'CreateNever'. Default: 'CreateNever'. ### Request Example { "appId": "YOUR_APP_ID", "clientKey": "YOUR_DEV_KEY", "apiVersion": "1.0.6", "userId": "hfarnsworth", "campaignId": 12345 } ``` -------------------------------- ### Configure Segment Analytics with Leanplum in AppDelegate (Swift) Source: https://docs.leanplum.com/docs/segment-integration-android Configure Segment analytics in your Swift application, specifying the Leanplum integration factory and your Segment write key. This setup also starts Leanplum. ```swift let configuration = AnalyticsConfiguration(writeKey: " [YOUR_SEGMENT_WRITE_KEY] ";) configuration.use(SegmentLeanplumIntegrationFactory()) Analytics.setup(with: configuration) ``` -------------------------------- ### Initialize Podfile Source: https://docs.leanplum.com/docs/mparticle-sdk Commands to initialize and open the Podfile in the terminal. ```bash $ pod init ``` ```bash $ open -a Xcode Podfile ``` -------------------------------- ### Start Campaign REST API Call Example Source: https://docs.leanplum.com/docs/manual-delivery Use this URL to manually trigger a campaign. Replace placeholders with your specific App ID, Development Client Key, User ID, and Campaign ID. The campaign ID can be found in the URL when viewing the campaign in the Leanplum dashboard. ```HTTP https://api.leanplum.com/api?appId=[ENTER_APP_ID]&clientKey=[ENTER_DEVELOPMENT_CLIENT_KEY]&apiVersion=1.0.6&action=startCampaign&userId=[ENTER_USER_ID]&campaignId=[ENTER_CAMPAIGN_ID] ``` -------------------------------- ### Initialize Leanplum SDK Source: https://docs.leanplum.com/reference/javascript-setup Configure the SDK with your App ID and keys, set initial variables, and start the session. ```javascript // This value should be set to true only if you're developing on your server. var isDevelopmentMode = true; // Sample variables. This can be any JSON object. var variables = { items: { color: 'red', size: 20, showBadges: true }, showAds: true }; // Get your App ID and Keys from https://www.leanplum.com/dashboard?#/account/apps if (isDevelopmentMode) { Leanplum.setAppIdForDevelopmentMode("YOUR_APP_ID", "YOUR_DEVELOPMENT_KEY"); } else { Leanplum.setAppIdForProductionMode("YOUR_APP_ID", "YOUR_PRODUCTION_KEY"); } Leanplum.setVariables(variables); Leanplum.start(function(success) { console.log('Success: ' + success); console.log('Variables', Leanplum.getVariables()); }); ``` -------------------------------- ### Handle Leanplum start response Source: https://docs.leanplum.com/reference/callbacks Execute code once the Leanplum start process completes. This callback is triggered only after the initial start and not on forceContentUpdate. ```swift // Add a callback. Leanplum.onStartResponse{ (success) in // Insert code here. } Leanplum.start() // Or, add a responder that will be executed as a callback. Leanplum.addStartResponseResponder(self, with: #selector(mySelector(success:))) func mySelector(success:Bool){ // Insert code here. } ``` ```objectivec // Add a callback. [Leanplum onStartResponse:^(BOOL success) { // Insert code here. }]; [Leanplum start]; // Or, add a responder that will be executed as a callback. [Leanplum addStartResponseResponder:self withSelector:@selector(mySelector:)]; - (void)mySelector:(BOOL) success { // Insert code here. } ``` ```java // Add a new callback. Leanplum.addStartResponseHandler(new StartCallback() { @Override public void onResponse(boolean b) { // Insert code here. } }); ``` ```csharp // Add a callback. Leanplum.Started += delegate(bool success) { // Insert code here. }; Leanplum.Start(); ``` ```javascript // Add a callback. Leanplum.addStartResponseHandler(function(success) { // Insert code here. }); Leanplum.start(); ``` ```smarty Leanplum.onStartResponse((success: boolean) => { if (success) { // handle success } else { // handle failure } }); ``` -------------------------------- ### POST /startCampaign Source: https://docs.leanplum.com/reference/post_api-action-startcampaign Activates a campaign for a specific device or user. Requires a clientKey for authentication. ```APIDOC ## POST /startCampaign ### Description Activates a campaign for one device or user. You must provide a `deviceId` and/or a `userId`. If `deviceId` is provided, the campaign top-level actions will be sent to the corresponding device only; if only `userId` is provided, the campaign top-level actions will be sent to all devices of the user with specified `userId`. If the user/device does not exist, sending the actions will be skipped. You can modify this behavior with the `createDisposition` option. This method requires your development API `clientKey`. ### Method POST ### Endpoint /websites/leanplum/startCampaign ### Parameters #### Query Parameters - **clientKey** (string) - Required - Your development API client key. - **deviceId** (string) - Optional - The ID of the device to activate the campaign for. - **userId** (string) - Optional - The ID of the user to activate the campaign for. If provided, actions are sent to all devices associated with this user. - **createDisposition** (string) - Optional - Modifies the behavior when a user/device does not exist. Possible values: 'create' or 'skip' (default). ### Request Example ```json { "deviceId": "your_device_id", "userId": "your_user_id", "createDisposition": "create" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. - **message** (string) - A message providing details about the operation. #### Response Example ```json { "status": "success", "message": "Campaign activated successfully." } ``` ``` -------------------------------- ### POST /api?action=start Source: https://docs.leanplum.com/reference/post_api-action-start Starts a new session and returns variables that have changed for the user. If the user or device does not exist, a new user is created based on the provided disposition. ```APIDOC ## POST /api?action=start ### Description Starts a new session and returns the variables that have changed for the user. If the user/device does not exist, a new user will be created (see the createDisposition option below). This method requires your production API clientKey. ### Method POST ### Endpoint /api?action=start ### Parameters #### Request Body - **appId** (string) - Required - The application ID. - **clientKey** (string) - Required - The Production key for your Leanplum App. - **apiVersion** (string) - Required - The version of the Leanplum API to use (1.0.6). - **userId** (string) - Required - The current user ID. - **deviceId** (string) - Optional - A unique ID for the device targeted by the request. - **devMode** (boolean) - Optional - Whether the user is in Development Mode. - **createDisposition** (string) - Optional - Policy for user creation (CreateIfNeeded, CreateNever). - **appVersion** (string) - Optional - The version of the app used on this device. - **systemName** (string) - Optional - The name of the OS the current device is running. - **systemVersion** (string) - Optional - The version number of the OS the current device is running. - **browserName** (string) - Optional - The name of the browser the current device is running. - **browserVersion** (string) - Optional - The version number of the browser the current device is running. - **deviceName** (string) - Optional - A human-readable name representing the device. - **deviceModel** (string) - Optional - The model name of the device. ### Request Example { "appId": "YOUR_APP_ID", "clientKey": "YOUR_PROD_KEY", "apiVersion": "1.0.6", "userId": "hfarnsworth" } ``` -------------------------------- ### Campaign event example Source: https://docs.leanplum.com/reference/interpreting-metrics-in-raw-data-export-files Example of a campaign entry event in a raw data export using the campaign ID. ```json { "time": 1.462301269315E9, "name": ".c(6349584728588288) Enter" } ``` -------------------------------- ### Message event example Source: https://docs.leanplum.com/reference/interpreting-metrics-in-raw-data-export-files Example of a message acceptance event in a raw data export using the message ID. ```json { "time": 1.462301269315E9, "name": ".m6678706135760896 Accept" } ``` -------------------------------- ### Objective-C: Callback for All Variables and Files Ready Source: https://docs.leanplum.com/reference/callbacks This callback executes after `start` and `forceContentUpdate` if any variables or files have changed and all downloads are complete. It can be added as a direct callback or a responder. ```objectivec // Add a callback. [Leanplum onVariablesChangedAndNoDownloadsPending:^() { goldStarImage = [UIImage imageWithContentsOfFile:[goldStar fileValue]]; }]; // Or, add a responder to be executed as a callback. [Leanplum addVariablesChangedAndNoDownloadsPendingResponder:self withSelector:@selector(customResponder)]; - (void)customResponder { // Insert code here. } ``` -------------------------------- ### Swift: Callback for All Variables and Files Ready Source: https://docs.leanplum.com/reference/callbacks This callback executes after `start` and `forceContentUpdate` if any variables or files have changed and all downloads are complete. ```swift // Add a callback. Leanplum.onVariablesChangedAndNoDownloadsPending { () in // Insert code here. } // Or, add a responder to be executed as a callback. Leanplum.addVariablesChangedAndNoDownloadsPendingResponder(self, with: #selector(self.customResponder)) func customResponder() { // Insert code here. } ``` -------------------------------- ### Java: Callback for All Variables and Files Ready Source: https://docs.leanplum.com/reference/callbacks This callback executes after `start` and `forceContentUpdate` if any variables or files have changed and all downloads are complete. ```java // Add a callback. Leanplum.addVariablesChangedAndNoDownloadsPendingHandler(new VariablesChangedCallback() { @Override public void variablesChanged() { // Insert code here. } }); ``` -------------------------------- ### Get All and Unread Messages (C#) Source: https://docs.leanplum.com/reference/app-inbox Access the Leanplum Inbox properties to get lists of all messages and unread messages. This is available after data loading. ```csharp var messages = Leanplum.Inbox.Messages; var unread = Leanplum.Inbox.UnreadMessages; ``` -------------------------------- ### Install CocoaPods for iOS Development Source: https://docs.leanplum.com/docs/segment-integration-android Install the CocoaPods dependency manager globally using the provided RubyGems command. This is a prerequisite for managing iOS project dependencies. ```bash $ sudo gem install cocoapods ``` -------------------------------- ### Initialize Podfile in iOS Project Source: https://docs.leanplum.com/docs/segment-integration-android Create a new Podfile in your iOS application's directory using the `pod init` command. This file will manage your project's dependencies. ```bash $ pod init ``` -------------------------------- ### Load Local Leanplum SDK Source: https://docs.leanplum.com/reference/javascript-setup Include this script tag in your HTML after downloading and hosting the SDK files locally. ```html ``` -------------------------------- ### React Native: On Start Response Source: https://docs.leanplum.com/docs/callbacks This React Native callback is invoked when the Leanplum start operation finishes. It allows you to handle both success and failure scenarios after data synchronization. ```javascript Leanplum.onStartResponse((success: boolean) => { if (success) { // handle success } else { // handle failure } }); ``` -------------------------------- ### Get Asset Variable in React Native Source: https://docs.leanplum.com/reference/variable-types Retrieve an asset variable using `Leanplum.getVariableAsset(ASSET_VARIABLE_NAME)`. This method is used to get the value of a previously set asset variable. ```javascript Leanplum.getVariableAsset(ASSET_VARIABLE_NAME); ``` -------------------------------- ### Get Inbox Message Counts (JavaScript) Source: https://docs.leanplum.com/reference/app-inbox Access the Leanplum Inbox object to get the total and unread message counts. Ensure data has finished loading before calling. ```javascript var inbox = Leanplum.inbox() var count = inbox.count() var unreadCount = inbox.unreadCount() ``` -------------------------------- ### C# Unity: Callback for All Variables and Files Ready Source: https://docs.leanplum.com/reference/callbacks This callback executes after `start` and `forceContentUpdate` if any variables or files have changed and all downloads are complete. ```csharp // Add a callback. Leanplum.VariablesChangedAndNoDownloadsPending += delegate { // Insert code here. }; ``` -------------------------------- ### Get App Inbox Instance Source: https://docs.leanplum.com/reference/app-inbox Use this call to get an instance of the App Inbox object. Available for iOS (Swift/Objective-C), Android, JavaScript, React Native, and Unity. ```swift Leanplum.inbox() ``` ```objectivec [Leanplum inbox] ``` ```java Leanplum.getInbox(); ``` ```javascript var inbox = Leanplum.inbox() ``` ```typescript LeanplumInbox.inbox().then(inbox=>{ //... }).catch(error=>{ //... }) ``` ```csharp Leanplum.Inbox ``` -------------------------------- ### Get Active Email Categories Source: https://docs.leanplum.com/docs/manage-email-subscriptions Use this GET request to retrieve a list of all active email categories and their corresponding IDs. This is a prerequisite for re-subscribing users to specific categories. ```http https://www.leanplum.com/api?appId=APP_ID&clientKey=READ_ONLY_KEY&action=getUnsubscribeCategories ``` -------------------------------- ### Install Leanplum React Native SDK via NPM Source: https://docs.leanplum.com/reference/react-native-setup Use this command to add the Leanplum SDK to your project. If using version 2.0.0 or above, also install the CleverTap SDK. ```shell npm install @leanplum/react-native-sdk // if using Leanplum React Native SDK 2.0.0, install also CT SDK npm install clevertap-react-native ``` -------------------------------- ### JavaScript: Add Start Response Handler Source: https://docs.leanplum.com/docs/callbacks Use this JavaScript callback to handle the response after Leanplum's start function completes. It's essential for asynchronous data loading. ```javascript // Add a callback. Leanplum.addStartResponseHandler(function(success) { // Insert code here. }); Leanplum.start(); ``` -------------------------------- ### Configure Podfile Source: https://docs.leanplum.com/reference/ios-setup Add the Leanplum SDK dependency to your Podfile. ```ruby pod 'Leanplum-iOS-SDK', '6.1.1' # Uncomment one of the following for Location Services. # pod 'Leanplum-iOS-Location', '6.1.1' # pod 'Leanplum-iOS-LocationAndBeacons', '6.1.1' ``` -------------------------------- ### Sample Implementation: didRegisterForRemoteNotificationsWithDeviceToken (Objective-C) Source: https://docs.leanplum.com/changelog/custom-push-notification-swizzling-for-ios Sample implementation for registering device tokens, ensuring Leanplum's SDK is correctly invoked. This is important if swizzling is disabled. ```objectivec - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // Needs to be called if swizzling is disabled in Info.plist otherwise it won’t affect SDK if swizzling is enabled. [Leanplum didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; } ``` -------------------------------- ### Example: Reverse Message Priority Source: https://docs.leanplum.com/changelog/unity-sdk-500 An example demonstrating how to use `Leanplum.PrioritizeMessages` to reverse the order of incoming messages. This handler receives messages ordered by priority and returns them in the reversed order. ```csharp Leanplum.PrioritizeMessages((contexts, trigger) => { // Reverse the messages order return contexts.Reverse().ToArray(); }); ``` -------------------------------- ### Objective-C: Add Start Response Callback Source: https://docs.leanplum.com/docs/callbacks This Objective-C callback is triggered once the Leanplum start method completes. It's useful for ensuring all necessary data is available before proceeding with UI updates. ```objectivec // Add a callback. [Leanplum onStartResponse:^(BOOL success) { // Insert code here. }]; [Leanplum start]; // Or, add a responder that will be executed as a callback. [Leanplum addStartResponseResponder:self withSelector:@selector(mySelector:)]; - (void)mySelector:(BOOL) success { // Insert code here. } ``` -------------------------------- ### Initialize CleverTap in Unity Editor Source: https://docs.leanplum.com/changelog/unity-sdk-710 Use this snippet to launch the CleverTap SDK specifically within the Unity Editor environment using your account credentials. ```C# #if UNITY_EDITOR string accountId = "YOUR_CLEVERTAP_ACCOUNT_ID"; string accountToken = "YOUR_CLEVERTAP_ACCOUNT_TOKEN"; string accountRegion = "YOUR_CLEVERTAP_REGION"; CleverTap.LaunchWithCredentialsForRegion(accountId, accountToken, accountRegion); // You can also use CleverTap.LaunchWithCredentials(accountId, accountToken) #endif ```