MiniGameInterstitial
Full-screen ad that drops in at natural transition points — after a conversation ends, between sessions, or after a message threshold. Users play a sponsored mini-game with an AI character.

Basic Usage
jsx
import { useEffect, useRef, useState } from 'react';
import { SimulaMiniGameInterstitial, SimulaEventType } from '@simula/ads-react-native';
function ChatScreen() {
const [loaded, setLoaded] = useState(false);
const retryAttempt = useRef(0);
const interstitial = useRef(null);
useEffect(() => {
interstitial.current = SimulaMiniGameInterstitial.init({
adUnitId: 'simula-xxxx-interstitial', // Optional: provided by Simula for tracking and measurement
});
const subs = [
interstitial.current.addAdEventListener(SimulaEventType.LOADED, () => {
retryAttempt.current = 0;
setLoaded(true);
}),
interstitial.current.addAdEventListener(SimulaEventType.LOAD_FAILED, () => {
retryAttempt.current += 1;
if (retryAttempt.current > 6) return;
const delay = Math.pow(2, retryAttempt.current);
setTimeout(() => interstitial.current.load(), delay * 1000);
}),
interstitial.current.addAdEventListener(SimulaEventType.CLOSED, () => {
setLoaded(false);
interstitial.current.load();
}),
];
interstitial.current.load();
return () => subs.forEach(sub => sub.remove());
}, []);
const handleMessageSent = () => {
if (messageCount % 20 === 0 && loaded) {
interstitial.current.show({
charID: 'luna-123', // Optional: current character, CharacterSelector pick, or omit for Simula default
charName: 'Luna',
charImage: 'https://cdn.example.com/avatars/luna.png',
});
}
};
return <ChatInterface onMessageSent={handleMessageSent} />;
}Init Config
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
adUnitId | string | No | — | Ad unit ID provided by Simula. Used for measurement and improved targeting. |
minPlayThreshold | number | No | 10 | Minimum play time in seconds. Clamped to [10, 30]. |
delegateChar | boolean | No | true | Whether Simula displays AI character messages inside the game iframe |
Show Config
The character info personalizes the game experience — the AI companion reacts to gameplay, sends messages, and is present throughout. Pass in the character the user is currently talking to, a character from CharacterSelector, or omit to use a Simula default.
| Parameter | Type | Required | Description |
|---|---|---|---|
charID | string | No | Character identifier |
charName | string | No | Character name displayed in header |
charImage | string | No | Character avatar URL |
charDesc | string | No | Character description |
Event Types
| Event | Payload | Description |
|---|---|---|
SimulaEventType.LOADED | — | Ad loaded and ready to show |
SimulaEventType.LOAD_FAILED | errorInfo | Ad failed to load. Retry with exponential backoff. |
SimulaEventType.DISPLAYED | adInfo | Ad displayed on screen |
SimulaEventType.DISPLAY_FAILED | errorInfo | Ad failed to display. Load next ad. |
SimulaEventType.CLICKED | adInfo | User tapped the ad |
SimulaEventType.CLOSED | adInfo | User closed the ad. Load next ad. |
Preload after close
Re-call .load() after CLOSED or DISPLAY_FAILED to preload and keep a fresh ad ready.
