NOTICEMicrosoft is replacing Xamarin with .NET MAUI and the supported for the latest release of Xamarin is till November 2023. MoEngage will stop providing updates for the MoEngage Xamarin SDK due to the deprecation. Deprecation impacts Xamarin In-App Messaging and will stop working after June 2022. All other features will continue to work in the Xamarin SDK until November 2023. |
Getting your App IDLogin to your MoEngage account, go to Settings in the left panel of the dashboard. Under App Settings, you will find your APP ID. |
Once the NuGet package is integrated you will have to initialize the iOS Application with the MoEngage App ID which you get from the dashboard. In your project, go to AppDelegate.cs
file and call the initialize method of MoEInitializer
instance inside FinishedLaunching()
as shown below:
using MoEngageXamarin.iOS;
namespace Sampleapp.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
#if DEBUG
MoEInitializer.InitializeDevWithAppID("Your App ID", app, options);
#else
MoEInitializer.InitializeProdWithAppID("Your App ID", app, options);
#endif
// Rest of the implementation
return base.FinishedLaunching(app, options);
}
// Rest of implementation
}
As you can see there are two separate methods for initializing the SDK InitializeDevWithAppID()
and InitializeProdWithAppID()
for TEST and LIVE environment of your account respectively.
MoEngage SDK makes use of the DEBUG preprocessor macro to decide whether the build is meant for TEST/LIVE Environment. Therefore you will have to make sure that Build Configuration of the App is set to RELEASE for the appstore build.
- For Development Build: Build Configuration should be set to Debug (Data will be tracked in TEST Environment)
- For AdHoc Build/App Store Build: Build Configuration should be set to Release (Data will be tracked in LIVE Environment)
What if Build Configuration is not set correctly?If the build configuration is not set correctly following might happen:
|
Data Redirection
IMPORTANTThis is only required if you have registered with account in EU region. |
We support data redirection to our EU servers from our SDK. This can be done by RedirectDataToRegion()
method to redirect the data to MoEDataRedirectionRegion.EU region. Make sure to call this method before initializing the SDK. Use the method as shown below:
// Call this method before SDK initialization
MoEInitializer.RedirectDataToRegion(MoEDataRedirectionRegion.EU);