sdk
Meiro SDK is an Android library that provides a simple way to interact with Meiro Data Platform. It is written in Kotlin but is usable from Java projects as well.
Installation
Define a dependency in your build.gradle file.
implementation("io.meiro:sdk:x.y.z")⚠️ Note: This SDK uses desugaring to use Java 8+ types on older Android versions. This requires your application to specify desugaring as well. Check official documentation how to integrate it.
Getting Started
To use the SDK it must first be initialized
MeiroSdk.init(
context = applicationContext,
configuration = Configuration(
endpoint = "https://my.meiro.me.endpoint/",
sourceSlug = "my_source_slug",
appId = getResources().getString(R.string.google_app_id),
)
)this call must be performed only once, usually in the Application.onCreate class.
The Context instance is stored in the SDK. To avoid memory leaks, never pass any Activity or other instances than Application instance to the SDK.
Configuration
Configuration object is used to configure the SDK. It has the following properties:
data class Configuration(
// Meiro Data Platform endpoint
val endpoint: String,
// Required for v2. Leave empty for v1.
val sourceSlug: String = "",
// application id. If you are using Firebase, you should use `R.string.google_app_id`
val appId: String,
// if enabled, includes additional logs. Should be disabled in production
val debugMode: Boolean = false,
// push notifications configuration
val pushNotifications: PushNotificationsConfiguration = PushNotificationsConfiguration(),
// automatic tracking options configuration
val automaticTrackingOptions: AutomaticTrackingOptions = AutomaticTrackingOptions(),
// language of the application. Used if you want to target users by language
val language: String? = null,
// Firebase project id. If you are using Firebase, you should use `R.string.project_id`
val firebaseProjectId: String? = null,
val apiVersion: ApiVersion = ApiVersion.V2,
// Optional profile-specific Audience WBS instance.
val audienceInstance: String? = null,
// forwarding of tracked events to another SDK in your app, e.g. Braze, see Event Forwarding below
val eventForwarding: EventForwarding? = null,
// consent applied at initialization; null restores the consent persisted by setEnabled
val initialEnabled: Boolean? = null,
// original destination of events queued by SDK versions that did not record it, see Offline support below
val legacyQueueDestination: QueueDestination? = null,
)
data class PushNotificationsConfiguration(
// Whether push notifications handling is enabled or not
val pushEnabled: Boolean = true,
// Accent color of push notification icon and buttons. A color value,
// not resource id, is expected here, e.g. context.resources.getColor(R.color.something)
var accentColor: Int? = null,
// Channel name for push notifications. Only for API level 26+.
var channelName: String = "Meiro",
// Channel description for push notifications. Only for API level 26+.
var channelDescription: String = "Notifications",
// Channel ID for push notifications. Only for API level 26+.
var channelId: String = "meiro_notifications",
// Icon to be showed in push notifications. A drawable resource id expected.
@DrawableRes
var pushIconResId: Int? = null,
)Event Endpoints
With ApiVersion.V2 (the default), events are delivered to two endpoints of the configured endpoint, depending on the event type:
| Events | Endpoint |
|---|---|
push notification events (fcm_registration_token_registered, fcm_message_received, fcm_message_click) | /api/channels/push/events |
| all other events | /collect/<sourceSlug> |
The event payload is the same for both, only the destination differs. Events that were queued by the #offline-support are routed the same way once connectivity is restored.
Switching between Czech v1 and Slovak v2
Configure both backends once in Application.onCreate, on the main thread. Profile IDs are stable installation-wide names; use cs for the Czech language and, for example, cz for its backend profile.
val profiles = mapOf(
"cz" to Configuration(
endpoint = "https://events.cz.example",
appId = getString(R.string.google_app_id),
apiVersion = ApiVersion.V1,
language = "cs",
audienceInstance = "client-cz",
firebaseProjectId = getString(R.string.project_id),
),
"sk" to Configuration(
endpoint = "https://events.sk.example",
sourceSlug = "mobile",
appId = getString(R.string.google_app_id),
apiVersion = ApiVersion.V2,
language = "sk",
audienceInstance = "client-sk",
firebaseProjectId = getString(R.string.project_id),
inAppMessagingEnabled = true,
),
)
MeiroSdk.init(this, profiles, activeProfile = savedBackendProfile)
// In the app's language-selection handler, on the main thread:
MeiroSdk.activateProfile(if (selectedLanguage == "cs") "cz" else "sk")
MeiroSdk.trackScreenView("home")activateProfile takes effect immediately without a restart or network flush. Persist the selected profile in the app and pass it as activeProfile on the next launch. An optional language argument updates that profile's event and messaging language. MeiroSdk.activeProfile reports the selection. Unknown profile IDs fail without changing the active profile. IDs must contain 1–64 ASCII letters, digits, underscores or hyphens.
V1 sends all events, including push events, to <endpoint>/meiro_mobile; sourceSlug is optional. V2 uses the routes above and requires sourceSlug. Both modes use the current JSON event envelope and preserve JSON value types. Older SDKs converted some native property values to strings; if the Czech source schema expects those strings, supply strings for those properties explicitly. In-app messaging is disabled for V1 even if requested, because its profile/frequency endpoints belong to the newer backend.
Each profile keeps its identity and offline queue. Switching starts a new session, dismisses the previous profile's messages, rebinds mounted placements, and registers the current FCM token with the selected backend. Events already accepted or queued retain their original endpoint, language and identity, including after process restart. Background workers can retry inactive profiles. Keep configured profiles available while their queues or notifications may still be pending. Profile endpoint, API version, source slug, app ID and Firebase project are persistently bound to the profile ID; changing them requires a new ID.
audienceInstance, when set, overrides the instance passed to getAudience().wbs(...). A result from a profile that was switched away from is cancelled through the error callback, so it cannot update the new profile's UI. The SDK does not automatically translate custom business-event property names.
For an existing installation, explicitly assign the old untagged queue to its previously configured backend once. This must not depend on the language selected during the upgrade:
MeiroSdk.init(this, profiles, activeProfile = savedBackendProfile, legacyProfile = "cz")Omitting legacyProfile leaves the old queue unassigned and untouched. Events the old queue holds for another destination stay held; with legacyQueueDestination on the legacy profile, its untagged events are assigned there instead. Consent set by setEnabled applies to all profiles, and queueStatus(), discardQuarantinedEvents() and retryPushRegistration() act on the active profile. The assignment is persisted and cannot later be moved to another profile. On first profile setup it also preserves the legacy identity; if a named profile already exists, its identity and queue are retained and the legacy queue is drained alongside it. Existing single-configuration initialization continues to use the original global storage.
Both sending backends must put the allowlisted profile ID in the push data, for example:
{"is_meiro_message":"true","message_id":"campaign-123","meiro_profile":"cz","title":"Offer"}A Czech notification received or clicked while Slovakia is active is reported to Czechia. The origin survives notification image work and pending intents. In named-profile mode missing/unknown origins are displayed and navigated when possible, but receipt/click tracking is skipped and logged; no endpoint is accepted from notification data. Single-configuration integrations continue accepting untagged pushes. Switching does not unsubscribe the token from the former backend; coordinate campaign eligibility and subscription policy on the servers if only the selected market should send notifications.
Automatic Events Tracking
Through Configuration.automaticTrackingOptions it's possible to configure automatic tracking of the following events:
data class AutomaticTrackingOptions(
// automatic tracking of activities/fragments screen views
val screenViewTracking: Boolean = true,
// automatic tracking of application lifecycle events such as app_installed, app_foreground and app_background
val lifecycleEventsTracking: Boolean = true,
// automatic tracking of Google Advertising ID attached to each event
val googleAdIdTracking: Boolean = true,
)For screen views see #screen-tracking for details
Google Advertising ID tracking
If AutomaticTrackingOptions.googleAdIdTracking enabled each event contains Google Advertising ID. This feature automatically adds com.google.android.gms.permission.AD_ID permission to the merged manifest. If you want to disable this feature, you can remove the permission by adding the following code to your AndroidManifest.xml:
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />Screen Tracking
By default the SDK tracks screen open events for Activities and Fragments. If you are using compose-navigation there is built-in extension on NavController that allows you to track screen open events.
import io.meiro.sdk.autoTrackScreenViews
...
navController.autoTrackScreenViews()If you don't use any of the before mentioned navigation libraries, you can manually track screen open events:
MeiroSdk.trackScreenView(name = "screen_name", properties = mapOf("product_id" to "1"))Event Properties
The properties map passed to trackCustomEvent and trackScreenView keeps the type of each value.
MeiroSdk.trackCustomEvent(
mapOf(
"product_name" to "T-Shirt", // sent as a JSON string
"price" to 9.99, // sent as a JSON number
"quantity" to 2, // sent as a JSON number
"in_stock" to true, // sent as a JSON boolean
"coupon" to null, // sent as JSON null
"attributes" to mapOf( // sent as a nested JSON object
"color" to "red",
"size" to "M",
),
"tags" to listOf("sale", "new"), // sent as a JSON array
)
)produces the following event_data in the request:
{
"product_name": "T-Shirt",
"price": 9.99,
"quantity": 2,
"in_stock": true,
"coupon": null,
"attributes": {
"color": "red",
"size": "M"
},
"tags": [
"sale",
"new"
]
}JSON structure is preserved for both real-time delivery and the #offline-support. Legacy queued records retain the string values stored by older SDK versions.
Whole floating point numbers are sent as integers (100.0 as 100), the same as the iOS SDK does. NaN and infinite values are not valid JSON numbers and are sent as strings.
Event Forwarding
Your app might use another SDK that needs your events too, for example Braze to trigger in-app messages. You don't need to track the events twice: Meiro SDK can forward the events it tracks to the other SDK.
Meiro SDK does not depend on the other SDK. Your app installs and initializes the other SDK as usual and gives Meiro SDK a function that hands every forwarded event over to it.
Forwarding events to Braze
Set up the Braze SDK as described in the Braze documentation, then pass EventForwarding in Configuration.eventForwarding:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Shows Braze in-app messages
registerActivityLifecycleCallbacks(BrazeActivityLifecycleCallbackListener())
MeiroSdk.init(
context = this,
configuration = Configuration(
endpoint = "https://my.meiro.me.endpoint/",
sourceSlug = "my_source_slug",
appId = getString(R.string.google_app_id),
eventForwarding = EventForwarding(
excludedEventTypes = setOf(
MeiroEventType.APP_FOREGROUND,
MeiroEventType.APP_BACKGROUND,
MeiroEventType.APP_INSTALLED,
MeiroEventType.FCM_TOKEN_REGISTERED,
),
excludedCustomEventNames = setOf("wishlist_add"),
) { name, properties ->
Braze.getInstance(applicationContext).logCustomEvent(name, BrazeProperties(JSONObject(properties)))
},
),
)
}
}With this configuration, calling
MeiroSdk.trackCustomEvent(mapOf("name" to "purchase", "price" to 10))sends the event to Meiro and logs a purchase custom event with the same properties in Braze. You can use it to trigger Braze in-app messages, which are triggered only by events logged by the Braze SDK on the device, not by events sent to Braze from servers. All other events are forwarded too, except the app lifecycle events, the push token registration and the wishlist_add custom event.
⚠️ Note: Meiro SDK starts tracking in MeiroSdk.init, e.g. the app_installed event on the first launch. If you configure Braze in code using Braze.configure, call it before MeiroSdk.init.
Excluding events from forwarding
All tracked events are forwarded, except the ones you exclude.
| Property | Default | Description |
|---|---|---|
eventNamePrefix | none | Prefix added to names of all forwarded events |
excludedEventTypes | none | Types of events that are not forwarded, see MeiroEventType |
excludedCustomEventNames | none | Names of custom events that are not forwarded |
customEventNameKey | "name" | Key in custom event properties that holds the custom event name |
Custom events are forwarded under their name, which is read from their properties under customEventNameKey. Custom events without a name are forwarded as event_custom. To exclude them, add event_custom to excludedCustomEventNames. To exclude all custom events, add MeiroEventType.CUSTOM to excludedEventTypes. Excluded names are matched without eventNamePrefix. All other events are forwarded under their MeiroEventType.id, e.g. screen_view.
Forwarded properties are the properties passed to trackCustomEvent or trackScreenView (with the screen name under the name key), the opened URL under the url key for LINK_CLICK, and the push notification data for FCM_MESSAGE_RECEIVED and FCM_MESSAGE_CLICK, and the message data (e.g. message_id, display_id, format) for in-app message, story and survey events (IN_APP_*, SURVEY_ANSWER). Other events have no properties. Push notification data values that contain JSON are forwarded parsed, the same as they are sent to Meiro: "5" as a number, "true" as a boolean and "{...}" as a map.
Exclude events the other SDK doesn't need. Without exclusions every screen view and every app foreground and background is forwarded too, and so is every event you start tracking later. Braze tracks sessions on its own, so it does not need the app lifecycle events.
Behavior
Only events that Meiro SDK tracks are forwarded. While the SDK is disabled using
setEnabled(false), no events are forwarded.Events are forwarded once they are accepted for delivery to Meiro, before they are sent, so the other SDK gets them without waiting for the network, also when the device is offline. A push token registration that is not sent again, because the backend already acknowledged it, is not forwarded either.
The forwarding function is called on the main thread in the order the events were tracked. Keep it fast, e.g. only call the other SDK there.
If the forwarding function throws an exception or an error, it is logged, the app keeps running and the event is still sent to Meiro.
With backend profiles, each profile uses the
eventForwardingof its ownConfiguration. Events of inactive profiles are not tracked, so they are not forwarded either, except push notification events, which are tracked by the profile that sent the notification.Meiro SDK does not identify users in the other SDK. If you identify your users in Braze, call
Braze.getInstance(context).changeUser(userId)yourself.Braze does not allow some keys in event properties, for example
timeandevent_name. Don't use them in custom events you forward to Braze.Braze downloads in-app message triggers at the start of a session. An event logged right after the app starts, e.g. during onboarding on the first launch, can come before the triggers, and the in-app message is not shown. See Braze troubleshooting for ways to design such campaigns.
Push Messaging
Meiro platform supports sending push notifications to users. This SDK handles push notifications displaying and tracking.
Notifications with images are displayed by WorkManager so downloads do not block the calling thread or the FCM callback. Downloads have a five-second timeout and a 2 MB limit; failed or invalid images fall back to a text notification. The worker retains display configuration across process recreation. High-priority messages use expedited work on Android 12 and newer, subject to system quotas.
If your application does not use Firebase Cloud Messaging, the SDK will automatically register the FirebaseMessagingService and will handle displaying of the push notifications.
If you are already using Firebase Cloud Messaging, you need to perform the following:
Pass the FCM token to the SDK by calling
MeiroEvents.setFcmToken(token). This should happen inonNewTokenmethod of subclass ofFirebaseMessagingService.Override
onMessageReceivedmethod ofFirebaseMessagingServiceand check whether the received message is Meiro message and then pass it to the SDK to perform the displaying. The code may look something like this
override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)
if (MeiroNotifications.isMeiroMessage(message)) {
MeiroNotifications.show(
context = this,
message = message
)
} else {
...
}
}The SDK does not handle requesting for the android.Manifest.permission.POST_NOTIFICATION permission for Android 33+. You need to request this permission for the SDK to be able to display push notifications.
Clicking the push notification may result in three scenarios based on a defined action property:
app- default launcher activity will be openedbrowser- url will be opened in the browserdeeplink- deeplink will be opened. In this case the application need to write a logic to register and handle the deeplink
In all three scenarios all of the properties from the data object of the push notification will be passed to the opened activity. In a case of nested objects the structure is represented as a JSON string.
Existing apps with Firebase Cloud Messaging
If you are already using Firebase Cloud Messaging in your app, you need to pass the FCM token to the SDK after the app start. This can be done by calling
FirebaseMessaging.getInstance().token.addOnSuccessListener { token ->
MeiroSdk.setFcmToken(token)
}eg. in Application.onCreate method.
Audience API
The SDK provides a simple way to interact with Meiro Data Platform Audience API. By calling the MeiroEvents.audience method the MeiroAudience instance is returned which contains wbs method encapsulating the Audience WBS API.
fun wbs(
instance: String,
parameters: Map<String, String> = emptyMap(),
segment: Int? = null,
callback: ResultCallback
)This method accepts mandatory instance argument representing your instance name in a CDP. You can pass optional parameters and the segment attributes to the request. The result is received through a callback property.
In onSuccess method you will receive a MeiroAudienceResult object containing the parsed returned_attributes and data properties of a response JSON. Type of these properties is JSONObject so it allows dynamic returned types.
In onError you may receive any exception that occurred during the request. There is predefined MeiroAudienceError exception informing about known error such as 404 - Customer not found.
Logging
MeiroSdk.init method accepts an optional logger parameter. By default it uses Android Log class with MeiroSDK tag. If you want to use a custom logger, you can implement MeiroLogger interface and pass your instance to the init method.
Offline support
Every event is stored in a queue before it is sent, and it is sent right away when the device is online. Each queued event belongs to the destination it was tracked for (endpoint, API version, source slug, Firebase app and project) and is never sent anywhere else. Only an HTTP 2xx response removes it from the queue.
Network failures and HTTP 408, 429, 500, 502, 503 and 504 retry, from 30 seconds doubling up to one hour, never sooner than the server's
Retry-After. The wait applies to all events of the destination and survives restarts.Other responses are permanent rejections. The event is held for review and does not block later events.
Events not delivered within 24 hours are held as expired.
Events queued by SDK versions before 2.2 have no recorded destination and are held until
Configuration.legacyQueueDestinationdeclares it. Events of another destination, e.g. after the app switched backends, are held until the app is configured for that destination again.
Held events stay on the device until you review and discard them:
lifecycleScope.launch {
val status = MeiroSdk.queueStatus() // pending, legacyUnassigned, otherDestination, rejected, expired
if (decidedToDropHeldEvents) MeiroSdk.discardQuarantinedEvents()
}setEnabled(false) is persisted and keeps queued events without sending them until the SDK is enabled again. Pass Configuration.initialEnabled to apply consent your app stores itself. A push token is registered once per destination, user and token; after fixing the cause of a rejected registration, call MeiroSdk.retryPushRegistration().
A background sync worker retries delivery, also if the SDK has not been initialized in the current process; initialize it in Application.onCreate for prompt delivery after process recreation. Delivery is at least once: a retry after a lost response can duplicate an event. See ../docs/backend-migration.md for upgrading an app to another backend.
In-app messaging
Enable HTML messaging explicitly. The SDK loads messages for the configured sourceSlug:
MeiroSdk.init(applicationContext, Configuration(
endpoint = "https://pipes.example.com/",
sourceSlug = "mobile-sdk",
appId = "your-app-id",
inAppMessagingEnabled = true,
))Create messages in Engage → Channels → In-app messaging. Modals use a native Dialog, dimmed backdrop, close control, Android Back dismissal, keyboard adjustment, and a bundled HTML/Liquid renderer inside WebView. Native content uses Android views without a WebView. Tapping outside the modal always closes it. The SDK uses the current resumed Activity and never opens messages from background.
Modals and sticky banners show a native close control (×, 48dp touch target, labeled "Close message") in a strip at the top of the card. A message can style it with color, backgroundColor, and borderColor (#RRGGBB or #RRGGBBAA) or hide it. A hidden control also removes the strip, so the creative fills the card; the creative must then provide its own close control with data-mpt-close or MeiroInApp.close(). Backdrop taps and Back still close modals.
For an inline View, add MeiroInAppMessageView(context, "home_promotion", MeiroSdk.inAppMessaging) to a container with known width. It grows to the content height and collapses when empty. In Compose use the standard AndroidView wrapper:
AndroidView(
modifier = Modifier.fillMaxWidth(),
factory = { context ->
MeiroInAppMessageView(context, "home_promotion", MeiroSdk.inAppMessaging)
},
)Import io.meiro.sdk.inappmessaging.MeiroInAppMessageView. No Compose dependency is added to the SDK itself. XML layouts can declare the placement directly after enabling in-app messaging in MeiroSdk.init:
<io.meiro.sdk.inappmessaging.MeiroInAppMessageView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:placementName="home_promotion" />XML placements use the initialized SDK's messaging instance. Views without a placement name remain empty. Each mounted placement name must be unique. Select the same name in Pipes. A complete inline message must be visible before its single display-instance impression is recorded; scrolling away and back does not add another impression.
Use trackScreenView("home") or trackCustomEvent(mapOf("name" to "show_offer")) for mobile triggers. Register named custom event types on the source when you also want to collect them. Conditions support local app context, event data, and realtime audiences. Message priority and installation session/day/lifetime caps determine selection.
MeiroSdk.inAppMessaging?.pause() cancels pending displays and retains visible content. resume() processes future triggers. onDiagnostic reports delivery failures without profile values. Global SDK disable stops new delivery. Resetting identity removes old content and pending work. New non-inline triggers are discarded while a modal, modal survey, or sticky banner is visible.
Story messages use an inline placement as a horizontal group rail. Tapping a group opens a full-screen player with timed progress, previous and next tap areas, a close control, accessibility labels, and optional deep-link actions. The player uses the rail's display ID and does not make a second frequency request. App background closes the player. The SDK collects in_app_story_group_open, in_app_story_view, in_app_story_complete, in_app_story_click, and in_app_story_close. Update the Mobile SDK source template before you enable stories.
Image messages from Asset Library use the same HTML renderer. The SDK waits for images to load before display and impression tracking. A failed or stalled image skips the candidate. Cached configuration does not guarantee that an image is available offline. Malformed message records are skipped; both native SDKs validate the same required trigger and frequency-cap fields.
Configuration refresh occurs on start and foreground, with a 24-hour cache. A refresh changes only the next render. Profile-dependent messages require fresh successful Profile API data for the current mobile_user_id. Missing required values skip the candidate. Each new display needs an online frequency-policy check, including messages with only local targeting. Select allowed attributes on the managed system-in-app-messaging Profile API endpoint; Liquid preserves attribute rows and dimension arrays. HTML JavaScript can call MeiroInApp.getProfile(), close(), and navigate(url). Navigation opens HTTPS or app deep links through the OS; unsafe schemes are rejected.
The SDK collects in_app_message_impression, in_app_message_click, in_app_message_close, and in_app_message_submit. Clicks include content and buttons; close means explicit dismissal only. A clicked close or submit button generates both events. Native event metadata includes message/version, display and occurrence IDs, and captured identity. Each retry preserves the occurrence ID. Named HTML form fields become arrays under fields. Use data-mpt-close for authored close controls and data-mpt-success for a form success state.
The native Android demo and LocalInAppMessagingTest are maintained in the private mobile SDK demos repository. Its README describes the bundled loopback backend, custom Pipes endpoints, and emulator integration tests.
Surveys and the shared frequency policy
Select a survey in Pipes for either a modal or inline message. The SDK uses the same survey renderer as Web Banners. Required answers are checked before submission. A successful form sends one survey_answer event per display, with survey version, question keys, captured mobile identity, and a stable response ID. Delivery retries keep that ID. Generic HTML forms continue to send in_app_message_submit.
The shared in_app Frequency Policy uses the exact mobile_user_id across messages, sources, and devices that share that identity. Installation-level per-message limits still apply. The default shared limit is one message per 12 hours. The SDK reserves capacity before a modal appears or a fully visible inline placement is revealed, then confirms the first impression. Definite cancellation before display releases the reservation. An uncertain network outcome retains capacity. Offline operation cannot start a new display, even when a cached configuration is available.
Deploy the Pipes changes, update the Mobile SDK source template, and release this SDK together. This SDK requires configuration schema version 2 and discards version 1 caches. Older SDK versions cannot read version 2; they can retain an earlier configuration for up to 24 hours and do not enforce the new shared policy during that cache window.
Sticky in-app banners
Sticky HTML and image messages need no placement view. In Pipes, select top or bottom and a maximum viewport height (default 30%, including the native close control unless the message hides it). Short content uses its natural height. Long content scrolls inside the banner. The host avoids system UI and the keyboard. The rest of the app remains interactive.
Report every navigation change with MeiroSdk.trackScreenView, including Compose navigation within one Activity. A sticky banner is removed on that report, Activity pause, or app background. It does not return on resume. Plain content taps and input focus do not close it. A successful link, completed authored action, or close control dismisses it after the action. Only one non-inline message can display at a time; ignored triggers are not replayed. Inline messages are independent, but covered placements do not record impressions.
Button and form handlers call MeiroInApp.completeAction() after their work succeeds. Pending or failed work must not call it. Click and submit events alone do not dismiss the banner. Completion has no effect on inline or modal messages.
Reusable surveys cannot use sticky format. Apply Mobile SDK source template version 2026-09-14.1 or later so message event schemas accept sticky. Older SDK versions skip sticky configuration records.
Custom renderer for native content
Set MeiroInAppMessaging.nativeRenderer once, for example in Application.onCreate, to draw messages with Native content with your own views or Compose components. It applies to every backend profile. The SDK still selects, personalizes, presents, and tracks the message, loads its images, and adds the close control of modal and sticky messages.
MeiroInAppMessaging.nativeRenderer = MeiroNativeRenderer { context, message, actions ->
ComposeView(context).apply { setContent { BrandMessage(message, actions) } }
}message.blocks contains image (a loaded Bitmap), text (personalized), buttons, and spacer blocks in the Pipes order, with their Pipes colors. Call actions.press(button) from a button: the SDK tracks the click, then opens the URL or closes the message. Call actions.close() for your own close control; message.closeButtonVisible is false when Pipes hides the SDK close button. Actions before the message is visible or after it closes do nothing. Return null to use the SDK view for one message. If render throws, the SDK skips the message. Return a new view each time. Its height can change; long content scrolls inside the host, so the view must not scroll itself (no LazyColumn or verticalScroll).
Migrating from 1.x to 2.0.0
Version 2.0.0 adapts the SDK to Meiro CDP v2 and contains breaking changes:
Configurationnewly requires asourceSlug, passing a blank one throws anIllegalArgumentExceptionevents are sent to the #event-endpoints instead of
<endpoint>/meiro_mobilethe deprecated
Configuration.automaticTrackingEnabledflag is removed, useautomaticTrackingOptionsinstead
No action is needed for events that are still queued offline, they are sent to the correct v2 endpoint.