Docs
grovs.io Start for free

In-app messages

Show Grovs in-app messages over a Unity game, hold them back during play, and react to taps and answers.

In-app messages are dashboard campaigns: a banner, modal, full-screen cover, system alert, question or your own HTML. The native SDK downloads live campaigns, picks one on the device for each app open, screen view or event, and draws it over the game. To create campaigns, see In-app messages.

No code is required. Once the package is set up, campaigns show. Use the calls below to keep messages out of gameplay or react to what the player did.

Screen-view triggers and excluded screens match the names you send with TrackScreenView, or scene names with Track scenes on.

React to messages

Grovs.InAppMessageEvent fires on the Unity main thread:

C#
using GrovsSDK;
using UnityEngine;
 
void OnEnable() => Grovs.InAppMessageEvent += OnInAppEvent;
void OnDisable() => Grovs.InAppMessageEvent -= OnInAppEvent;
 
void OnInAppEvent(InAppMessageEvent e)
{
    switch (e.Type)
    {
        case InAppEventType.Clicked:
            // Payload is set for a key-value action
            if (e.Payload != null && e.Payload.TryGetValue("reward", out var reward)) GiveReward(reward);
            break;
        case InAppEventType.Dismissed:
            Debug.Log("Dismissed: " + e.DismissReason);
            break;
        case InAppEventType.Answered:
            Debug.Log("Answer: " + e.AnswerValue + " " + e.Comment);
            break;
        case InAppEventType.Failed:
            Debug.LogWarning(e.FailureMessage);
            break;
    }
}
FieldSet forDescription
TypeAllShown, Clicked, Dismissed, Answered or Failed
CampaignIdAllThe campaign. Can be null for Failed on iOS.
ButtonIdClickedThe tapped button. null when the message body was tapped.
PayloadClickedThe pairs of a key-value action, else null
DismissReasonDismissedclose_button, backdrop, swipe, app or orientation
AnswerValueAnsweredA long (1 to 5) for stars, or a string option ID for a choice
CommentAnsweredThe player's comment, or null
FailureMessageFailedWhy the message couldn't be shown

A Failed event is also reported to ErrorOccurred with code InAppDisplayFailed.

Hold a message back

Set a veto. Return false to skip a message, true to show it:

C#
// Read a plain field here, updated from game code.
static volatile bool inMatch;
 
Grovs.ShouldShowInAppMessage = campaignId => !inMatch;

ShouldShowInAppMessage runs synchronously on a native thread. On iOS that's the main thread. On Android it's the Android UI thread, which isn't Unity's thread. Keep it fast and don't call Unity APIs from it. Read a field you update from game code instead.

null (the default) shows every message. If the delegate throws, the exception is logged and the message shows.

Pause and exclude

C#
// During a boss fight. The newest highest priority message waits.
Grovs.PauseInAppMessages();
 
// Show messages again, starting with the one that waited, if it still qualifies.
Grovs.ResumeInAppMessages();
 
// Drop the waiting message. Pass true to also close the one on screen.
Grovs.DiscardInAppMessages(dismissCurrent: true);
 
// No message shows on these screens.
Grovs.SetInAppExcludedScreens(new List<string> { "Gameplay" });

SetInAppExcludedScreens(null) clears the list.

Over the game

iOSAndroid
Where the message drawsA window above Unity'sA dialog over the Unity activity. Unity may get OnApplicationFocus(false) while it's shown.
Veto threadMain thread (Unity's)Android UI thread (not Unity's)

Debugging

C#
Grovs.SetLogLevel(GrovsLogLevel.Info);
Grovs.SetInAppDebugLogging(true);

The native SDK then logs each campaign considered for an event and why it was skipped.

Native behavior

Triggers, sync, frequency caps, button actions, questions, custom HTML and test messages work as in the native SDK. See iOS in-app messages for the details and the reserved event names.

See also

Last updated 2026-10-26
Was this page helpful?