Get started

Prev Next

The Mapp Engage Flutter plugin connects your Flutter application to the native Mapp Engage SDKs on Android and iOS. It lets you initialize the SDK, register devices, manage user aliases, enable push notifications, and use engagement features such as in-app messaging and geofencing.

This guide helps you complete a basic integration and verify that the SDK is ready to use.


Before you begin

Make sure the following prerequisites are in place:

  • A Flutter application

  • Access to your Mapp Engage credentials:

    • SDK key

    • App ID

    • Tenant ID

    • Server region

  • For Android, a Google project ID if required by your setup

  • For iOS, the required push notification capabilities and APNs configuration in Xcode

If you plan to use geofencing, add the required location permissions for the target platform before enabling those features.

Minimum requirements

  • Dart 3.5.0 or later, Flutter 3.24.0 or later

  • Android: compileSdkVersion 36 or later

  • iOS: iOS 12.0 or later (SDK 6.x)


Install the Flutter plugin

Add the plugin to your pubspec.yaml file:

dependencies:
  mapp_sdk: ^0.0.13

Then install the dependency:

flutter pub get

Import the SDK

Import the required package in your application:

import 'package:mapp_sdk/mapp_sdk.dart';
import 'package:mapp_sdk/helper_classes.dart';
import 'package:mapp_sdk/notification_mode.dart';

The notification_mode.dart import is only required if you want to customize the notification mode during initialization.


Initialize the SDK

Initialize Mapp Engage before calling runApp(). This must be the first Mapp Engage call in your application lifecycle.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await MappSdk.engage(
    'YOUR_SDK_KEY',
    'YOUR_GOOGLE_PROJECT_ID', 
    SERVER.L3,
    'YOUR_APP_ID',
    'YOUR_TENANT_ID',
    NotificationMode.backgroundAndForeground,
  );

  runApp(MyApp());
}

Initialization parameters

Parameter

Type

Description

sdkKey

String

The SDK key provided for your Mapp Engage setup.

googleProjectId

String

The Google project ID. On iOS, pass an empty string if it is not used.

server

SERVER

The Mapp Engage backend region.

appID

String

Your application ID, provided as a string.

tenantID

String

Your Mapp Engage tenant identifier.

notificationMode

NotificationMode?

Optional. Controls when push notifications are shown. The default is backgroundAndForeground.


Select a notification mode

You can control how notifications are displayed during initialization.

Value

Description

backgroundAndForeground

Show notifications when the app is in the background and foreground. This is the default value.

backgroundOnly

Show notifications only when the app is in the background.

silentOnly

Receive push payloads without displaying a visible notification.


Verify that the SDK is ready

After initialization, check whether the SDK is ready before calling other SDK methods.

final bool ready = await MappSdk.isReady();

if (ready) {
  print('Mapp Engage is ready.');
} else {
  print('Mapp Engage is not ready yet.');
}

Retrieve the current alias

When initialization succeeds, the SDK assigns an anonymous AUTO alias to the device. You can retrieve it with getAlias().

final String alias = await MappSdk.getAlias();
print('Current alias: $alias');

This alias represents the current device until you assign a known user identifier with setAlias().


Next steps

After the basic integration is complete, continue with the following topics: