In-App Message¶
You can start delivering in-app message right after integrating the SDK. Specify the display timing at Trigger by Event when creating the message.
However, if the following cases apply, you need to add / change the implementation.
In case you have to add or change the implementation¶
When a splash screen is presented on app startup or while a screen transition is performed¶
An implementation like this may lead to a not properly displayed in-app messages if the trigger is set to "App Launch".
In this case it is possible to prolong the presentation of in-app messages by using the following SDK API functions.
Repro SDK 5 or above¶
First, call disableInAppMessagesOnForegroundTransition
before setup
.
#import <Repro/Repro.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[Repro disableInAppMessagesOnForegroundTransition];
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
import Repro
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
Repro.disableInAppMessagesOnForegroundTransition()
Repro.setup("YOUR_APP_TOKEN")
...
}
import Repro
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
Repro.disableInAppMessagesOnForegroundTransition()
Repro.setup(token: "YOUR_APP_TOKEN")
...
}
import io.repro.android.Repro;
...
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
...
Repro.disableInAppMessagesOnForegroundTransition()
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
}
ReproCpp::disableInAppMessagesOnForegroundTransition();
using UnityEngine;
public class MyBehaviour : MonoBehaviour {
void Start () {
...
Repro.DisableInAppMessagesOnForegroundTransition()
Repro.Setup ("YOUR_APP_TOKEN");
...
}
}
onDeviceReady: function() {
app.receivedEvent('deviceready');
Repro.disableInAppMessagesOnForegroundTransition();
Repro.setup("YOUR_APP_TOKEN");
}
//
// call disableInAppMessageOnActive method in your native code like shown bellow.
//
// iOS(Objective-C): AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Repro disableInAppMessagesOnForegroundTransition];
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
// Android(Java): MainApplication
@Override
public void onCreate() {
super.onCreate();
Repro.disableInAppMessagesOnForegroundTransition()
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
//
// call disableInAppMessagesOnForegroundTransition method in your native code like shown bellow.
//
// iOS(Objective-C): AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[Repro disableInAppMessagesOnForegroundTransition];
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
// Android(Java): MyApplication
@Override
public void onCreate() {
super.onCreate();
Repro.disableInAppMessagesOnForegroundTransition();
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
And call enableInAppMessagesOnForegroundTransition
when the splash screen is closed.
[Repro enableInAppMessagesOnForegroundTransition];
Repro.enableInAppMessagesOnForegroundTransition()
Repro.enableInAppMessagesOnForegroundTransition()
import io.repro.android.Repro;
public class MyActivity extends Activity {
protected void someFunc() {
...
// you should pass current visible activity to enableInAppMessagesOnForegroundTransition()
Repro.enableInAppMessagesOnForegroundTransition(this);
...
}
}
ReproCpp::enableInAppMessagesOnForegroundTransition();
Repro.EnableInAppMessagesOnForegroundTransition();
Repro.enableInAppMessagesOnForegroundTransition();
Repro.enableInAppMessagesOnForegroundTransition();
await Repro.enableInAppMessagesOnForegroundTransition();
Note
disableInAppMessagesOnForegroundTransition is a method dedicated to the "App Launch" event, which is supposed to be used when the splash screen will be presented at the time of application startup. It is not possible to control the display timing of events other than "App Launch".
Repro SDK below version 5¶
First, call disableInAppMessageOnActive
before setup
.
#import <Repro/Repro.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
[Repro disableInAppMessageOnActive];
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
import Repro
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
Repro.disableInAppMessageOnActive()
Repro.setup("YOUR_APP_TOKEN")
...
}
import Repro
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
Repro.disableInAppMessageOnActive()
Repro.setup(token: "YOUR_APP_TOKEN")
...
}
import io.repro.android.Repro;
...
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
...
Repro.disableInAppMessageOnActive()
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
}
#include "ReproCpp.h"
bool AppDelegate::applicationDidFinishLaunching() {
...
ReproCpp::disableInAppMessageOnActive();
ReproCpp::setup("YOUR_APP_TOKEN");
...
}
using UnityEngine;
public class MyBehaviour : MonoBehaviour {
void Start () {
Repro.DisableInAppMessageOnActive ();
Repro.Setup ("YOUR_APP_TOKEN");
}
}
onDeviceReady: function() {
app.receivedEvent('deviceready');
Repro.disableInAppMessageOnActive();
Repro.setup("YOUR_APP_TOKEN");
}
//
// call disableInAppMessageOnActive method in your native code like shown bellow.
//
// iOS(Objective-C): AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Repro disableInAppMessageOnActive];
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
// Android(Java): MainApplication
@Override
public void onCreate() {
super.onCreate();
Repro.disableInAppMessageOnActive()
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
// Flutter SDK does not support this feature under SDK version 5.
And call showInAppMessage
when the app is ready to display the message.
[Repro showInAppMessage];
Repro.showInAppMessage()
Repro.showInAppMessage()
import io.repro.android.Repro;
public class MyActivity extends Activity {
protected void someFunc() {
...
// you should pass current visible activity to showInAppMessage()
Repro.showInAppMessage(this);
...
}
}
ReproCpp::showInAppMessage();
Repro.ShowInAppMessage ();
Repro.showInAppMessage();
Repro.showInAppMessage();
// Flutter SDK does not support this feature under SDK version 5.
Note
disableInAppMessageOnActive is a method dedicated to the "App Launch" event, which is supposed to be used when the splash screen will be presented at the time of application startup. It is not possible to control the display timing of events other than "App Launch".
In case an in-app message trigger (other than "App Launch") is executed immediately after the application has started¶
Since the SDK will load the data for in-app message presentation right after the application enters foreground, depending on network conditions the message may not be presented in the same foreground background cycle.
In this case, please consider changing the display trigger of the in-app message to "App Launch" or delay execution of the event.
When an event executed before or after the screen transition is used as a display trigger for an in-app message¶
If you try to display in-app messages before or after screen transition, there is a possibility that messages may not be displayed due to the influence of draw delay.
Please refer to the table below to see what event will trigger in-app messages.
iOS
Execution timing |
Dialog, Overlay |
Banner |
---|---|---|
viewDidLoad | × | × |
viewWillAppear | ◯ (× if iOS SDK is less than 3.1.0) |
◯ |
viewDidAppear | ○ | ◯ |
viewWillDisappear | ◯ (× if iOS SDK is less than 3.1.0) |
◯ |
viewDidDisappear | ○ | × |
Android
Execution timing |
Dialog, Overlay |
Banner |
---|---|---|
onCreate | × | × |
onStart | × | × |
onResume | ○ | ◯ |
onPause | × | × |
onStop | ○ | ◯ |
onDestroy | ○ | ◯ |
onRestart | × | × |
Warning
On Android an in-app message can't be display if no activity in resume state is present at the moment of displaying the in-app message.