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(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");
...
}
}
import io.repro.android.Repro
...
class MyApplication : Application() {
override fun 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()
import io.repro.android.Repro;
public class MyActivity extends Activity {
protected void someFunc() {
...
// you should pass current visible activity to enableInAppMessagesOnForegroundTransition()
//Repro.enableInAppMessagesOnForegroundTransition(this);
// activity not necessary for Android SDK 5.24.0 Later
Repro.enableInAppMessagesOnForegroundTransition();
...
}
}
import io.repro.android.Repro
class MyActivity : Activity() {
protected fun someFunc() {
...
// you should pass current visible activity to enableInAppMessagesOnForegroundTransition()
//Repro.enableInAppMessagesOnForegroundTransition(this)
// activity not necessary for Android SDK 5.24.0 Later
Repro.enableInAppMessagesOnForegroundTransition()
...
}
}
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”.
Warning
Starting with Android SDK 5.24.0, the enableInAppMessagesOnForegroundTransition method no longer requires an Activity argument. The version of enableInAppMessagesOnForegroundTransition that takes an argument can still be used, but it is now Deprecated. Please use the version of enableInAppMessagesOnForegroundTransition that takes no arguments.
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(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");
...
}
}
import io.repro.android.Repro
...
class MyApplication : Application() {
override fun 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()
import io.repro.android.Repro;
public class MyActivity extends Activity {
protected void someFunc() {
...
// you should pass current visible activity to showInAppMessage()
Repro.showInAppMessage(this);
...
}
}
import io.repro.android.Repro
class MyActivity : Activity() {
protected fun 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 |
◯ |
◯ |
viewDidAppear |
○ |
◯ |
viewWillDisappear |
◯ |
◯ |
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.
Using a custom URL Scheme¶
The scheme portion of the custom URL Scheme must be specified in lower case. When using a custom URL Scheme to transition to a button displayed in an HTML in-app message, the scheme portion is automatically converted to lowercase and processed. Please note that the conversion may result in scheme mismatch issues.
Using Universal-Links / App-Links¶
It is possible to custom handle the opening of Universal-Links (also called App-Links) when Push Notifications or In-App Messages are tabbed. (For simplification from now only called Universal-Links.)
Please follow the examples below in order to add a custom Universal-Link callback handler which is executed every time an Universal-Link would be opened from a Push-Notification or In-App Message.
How to register a regular expression to match Universal-Links.¶
In order to use Universal-Link callbacks, a regular expression based url matcher must be added.
Note
When a pattern (regular expression) is matched, the callback process described below is kicked to the URL set as the destination for opening a push notification or a message in the application.
When HTML content is displayed in in-app messages, universal linking is also determined for requests that occur within that content.
For iOS apps, these matcher regular expressions can be added in the AppDelegate or in the Apps designated .plist file. For Android apps your class that extents Application can be used or if that is not possible, the regular expressions can also be added to your AndroidManifest.xml file.
// AppDelegate.m
#import <Repro/Repro.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Repro addOpenUrlFilterRegEx:@"https://example\\.com/page/"];
[Repro addOpenUrlFilterRegEx:@"your-domain\\.com/.+\?universal=true"];
...
}
// .plist file
/*
<dict>
<key>RPROpenUrlFilterRegExList</key>
<array>
<string>https://example\.com/page/</string>
<string>your-domain\.com/.+\?universal=true</string>
</array>
...
</dict>
*/
// MyApplication.java
import io.repro.android.Repro;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
Repro.addOpenUrlFilterRegEx("https://example\\.com/page/");
Repro.addOpenUrlFilterRegEx("your-domain\\.com/.+\\?universal=true");
...
}
...
}
// AndroidManifest.xml
// To specify multiple URL patterns, enter them separated by commas.
<application>
...
<meta-data
android:name="io.repro.android.OpenUrlFilterRegExList"
android:value="https://example\\.com/page/;your-domain\\.com/.+\\?universal=true">
</meta-data>
</application>
// MyApplication.kt
import io.repro.android.Repro
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Repro.addOpenUrlFilterRegEx("https://example\\.com/page/")
Repro.addOpenUrlFilterRegEx("your-domain\\.com/.+\\?universal=true")
...
}
...
}
// AndroidManifest.xml
// To specify multiple URL patterns, enter them separated by commas.
<application>
...
<meta-data
android:name="io.repro.android.OpenUrlFilterRegExList"
android:value="https://example\\.com/page/;your-domain\\.com/.+\\?universal=true">
</meta-data>
</application>
// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
Repro.add(openUrlFilterRegEx: "https://example\\.com/page/")
Repro.add(openUrlFilterRegEx: "your-domain\\.com/.+\\?universal=true")
...
}
// .plist file
/*
<dict>
<key>RPROpenUrlFilterRegExList</key>
<array>
<string>https://example\.com/page/</string>
<string>your-domain\.com/.+\?universal=true</string>
</array>
...
</dict>
*/
Please follow native iOS and Android instructions in order to add the filters
to the plist/AndroidManifest files or the main AppDelegate/Application classes.
Please follow native iOS and Android instructions in order to add the filters
to the plist/AndroidManifest files or the main AppDelegate/Application classes.
// YourAppNameScene.cpp
bool YourAppName::init() {
ReproCpp::addOpenUrlFilterRegEx("https://example\\.com/page/");
ReproCpp::addOpenUrlFilterRegEx("your-domain\\.com/.+\\?universal=true");
...
}
Please follow native iOS and Android instructions in order to add the filters
to the plist/AndroidManifest files or the main AppDelegate/Application classes.
Please follow native iOS and Android instructions in order to add the filters
to the plist/AndroidManifest files or the main AppDelegate/Application classes.
Warning
Specify the URL pattern to be set as a universal link as concretely as possible, including the domain and path , and should be all in lowercase .
If only a scheme is specified, such as https, a request made by a script executed in a screen displayed by an in-app message may be mistakenly judged as a universal link, and callback processing may be executed at an unintended timing.
If uppercase letters are used in the scheme/domain portion of the URL pattern, the scheme/domain portion is automatically converted to lowercase and processed when attempting to use a universal link to transition from a button displayed in an HTML in-app message. The pattern (regular expression) may not match and callback processing may not be executed at the intended timing.
Adding a callback handler for opening Universal-Links¶
Next a callback handler for custom processing of Universal-Links is added. The URL that was about to be opened is passed to the callback, where then depending on the URL custom code can be executed.
#import <Repro/Repro.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Repro setOpenUrlCallback:^(NSURL *url) {
if ([url.host isEqualToString:@"example.com"]) {
// In case of your universal link perform navigation, present content, ...
handleUniversalLink(url);
}
}];
...
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
// Set a callback that is executed everytime an URL is about to be opened
Repro.setOpenUrlCallback { url in
if url.host == "example.com" {
// In case of your universal link perform navigation, present content, ...
handleUniversalLink(url)
}
}
...
Repro.setup(token: "YOUR_APP_TOKEN")
...
import io.repro.android.Repro;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// In order to execute a callback when a push notification is tapped,
// the callback must be set in Application, not Activity.
Repro.setOpenUrlCallback(new Repro.OpenUrlCallback() {
// ** This callback method is executed in the main thread **
@Override
public void onOpened(Uri uri) {
if ("example.com".equals(uri.getHost())) {
// In case of your universal link perform navigation, present content, ...
}
}
});
...
Repro.setup(this, YOUR_APP_TOKEN);
...
}
...
}
import io.repro.android.Repro
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// In order to execute a callback when a push notification is tapped,
// the callback must be set in Application, not Activity.
Repro.setOpenUrlCallback { uri ->
// ** This callback method is executed in the main thread **
if (uri.host == "example.com") {
// In case of your universal link perform navigation, present content, ...
}
}
...
Repro.setup(this, "YOUR_APP_TOKEN")
...
}
...
}
Repro.setOpenUrlCallback((uri) { // uri is of type Uri
debugPrint("Universal Link Callback Handler received: " + uri.toString());
});
// Somewhere before Repro.Setup(...)
Repro.SetOpenUrlCallback(uri => // uri is of type Uri
{
Debug.Log("Universal Link Callback Handler received: " + uri.ToString());
});
bool YourAppName::init() {
ReproCpp::addOpenUrlFilterRegEx(...);
ReproCpp::setOpenUrlCallback([](const char *url) {
if (strcmp(url, "example.com") == 0) {
// In case of your universal link perform navigation, present content, ...
}
});
ReproCpp::setup("YOUR_APP_TOKEN")
...
}
Repro.setOpenUrlCallback(function(url) { // url is of type String
alert('Universal Link Callback Handler received: ' + url);
if (url.includes("http://example.org")) {
// In case of your universal link perform navigation, present content, ...
}
});
Repro.setOpenUrlCallback( (url) => { // url is of type String
console.log('Universal Link Callback Handler received: ' + url);
if (url.includes("http://example.org")) {
// In case of your universal link perform navigation, present content, ...
}
});
Note
In case you are using Cocos2d-x, an update of one Android bridge file is necessary.For details, please refer to the original installation instructions for adding the bridge code.
When App-Bound Domains is enabled (iOS only)¶
If you have enabled iOS’s App-Bound Domains , HTML In-App Message will not display by default.
To display the HTML in-app message, the following steps are required.
Please update to iOS SDK version 5.22.0 or later.
Add https://io.repro.repro to the list of App-Bound Domains, or add
RPRHtmlInAppBaseUrlto your app’sInfo.plistfile and set it to the URL configured in App-Bound Domains.
The following is sample code for adding RPRHtmlInAppBaseUrl to the app’s Info.plist file.
<dict>
...
<key>RPRHtmlInAppBaseUrl</key>
<string>https://example.com</string>
</dict>
Displaying a specific in-app message when the app is launched via a deep link¶
You can display a specific in-app message when the app is launched via a deep link.
In this case, you need to implement passing the deep link URL to deepLinkReceived. If the query of the URL (the string after ?) contains a parameter named reproEventKey, the SDK tracks an event whose name is the value of that parameter. An in-app message that has the event set as its display trigger is then displayed when the app is launched.
Launching the app via a deep link is implemented on the app side, independently of the Repro SDK. The following sections explain how to add a call to deepLinkReceived to that implementation for each type of deep link (custom URL Scheme, Universal Links/App Links, and push notifications).
Warning
This feature requires Repro iOS SDK 5.24.0 or higher, or Repro Android SDK 5.23.0 or higher.
Repro iOS SDK 5.25.0 or higher and Repro Android SDK 5.25.0 or higher are required when using event properties.
Note
We do not recommend using this feature with deferred deep linking of Adjust or AppsFlyer.
Deferred deep linking passes the parameters attached to a deep link that was opened in the past when the app is installed from the store and launched.
This feature can also receive those parameters and display an in-app message with them, but a delay of about 2 to 5 seconds occurs before the parameters are received.
As a result, an in-app message may be displayed at an unintended timing while the user is operating the app.
Common¶
This feature works by passing the URL of the deep link implemented in your app to the method deepLinkReceived. Call deepLinkReceived and pass the URL where the deep link URL is available.
The SDK looks for the parameter named reproEventKey in the query of the URL passed to deepLinkReceived. If it exists, the SDK reads its value as a string and tracks a Repro event whose name is that value. An in-app message is displayed when the event is set as its display trigger.
URL examples¶
myapp://example/aaa?reproEventKey=イベント名
https://example.com/aaa?reproEventKey=イベント名
Dashboard setting example¶
When the event name is beforeOnloadEvent, configure the display trigger of the in-app message as follows.
Note
An event must have been tracked at least once before it can be selected as a display trigger.
Using event properties¶
This feature can attach event properties to the tracked event.
There are two ways to attach event properties: passing reproEventPropertyKey and reproEventPropertyValue separately, or passing a JSON string to reproEventPropertyJson. If both are set, the JSON string takes precedence.
Warning
Using event properties requires Repro iOS SDK 5.25.0 or higher, or Repro Android SDK 5.25.0 or higher.
URL examples¶
myapp://example/aaa?reproEventKey=イベント名&reproEventPropertyKey=イベントプロパティKey&reproEventPropertyValue=イベントプロパティValue
https://example.com/aaa?reproEventKey=イベント名&reproEventPropertyKey=イベントプロパティKey&reproEventPropertyValue=イベントプロパティValue
myapp://example/aaa?reproEventKey=イベント名&reproEventPropertyJson=KeyValueが設定されたJSON String
https://example.com/aaa?reproEventKey=イベント名&reproEventPropertyJson=KeyValueが設定されたJSON String
The following is an example of the JSON string passed to reproEventPropertyJson. URL-encode it when including it in the URL query.
// Example JSON string
{"couponId": "1234", "campaign": "summer_sale"}
// Example URL with the JSON string URL-encoded in the query
myapp://example/aaa?reproEventKey=openCoupon&reproEventPropertyJson=%7B%22couponId%22%3A%221234%22%2C%22campaign%22%3A%22summer_sale%22%7D
Implementation on iOS¶
Using a custom URL Scheme¶
To use this feature with a custom URL Scheme, call deepLinkReceived and pass the URL where you receive the URL.
The following SwiftUI sample code shows where to pass the URL to deepLinkReceived. If you use AppDelegate or SceneDelegate, adapt the code accordingly.
// SceneDelegate.m
- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts
{
NSURL *url = URLContexts.anyObject.URL;
[Repro deepLinkReceived:url]; // <= Add this line
// Screen routing
if ([url.path isEqualToString:@"/XXXX"]) {
...
}
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
// Modifier called when the app is opened via a URL
.onOpenURL { url in
handleIncomingURL(url)
}
}
}
/// Parse the URL and navigate to the appropriate screen
func handleIncomingURL(_ url: URL) {
Repro.deepLinkReceived(url: url) // <= Add this line
// Screen routing
if url.path == "/XXXX" {
...
}
}
}
// This section explains the implementation in iOS.
// Please change the language to Objective-C or Swift.
// This section explains the implementation in iOS.
// Please change the language to Objective-C or Swift.
Using Universal Links¶
As with a custom URL Scheme, to use this feature with Universal Links, call deepLinkReceived and pass the URL where you receive the URL.
// AppDelegate.m
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> *))restorationHandler
{
NSURL *url = userActivity.webpageURL;
[Repro deepLinkReceived:url]; // <= Add this line
// Screen routing
if ([url.path isEqualToString:@"/XXXX"]) {
...
}
return YES;
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onOpenURL { url in
// Handle a detected Universal Link
handleUniversalLink(url)
}
}
}
func handleUniversalLink(_ url: URL) {
Repro.deepLinkReceived(url: url) // <= Add this line
// Screen routing
if url.path == "/XXXX" {
...
}
}
}
// This section explains the implementation in iOS.
// Please change the language to Objective-C or Swift.
// This section explains the implementation in iOS.
// Please change the language to Objective-C or Swift.
Using push notifications¶
If you want to pass a deep link URL when a push notification is opened, use Repro’s Universal Links feature. When the deep link field of the push message (see the image below) matches a Universal Link URL pattern, the URL is automatically passed to deepLinkReceived. No additional implementation is required if the URL pattern is already registered.
Changing the parameter name to be read¶
The parameter key that Repro reads is reproEventKey by default, but you can change this key name.
To change the key name on iOS, add the following key and value to the Info.plist of your app.
Key |
Type |
Value |
|---|---|---|
|
String |
The key name you want to use |
You can add it in the source code as follows.
<key>RPRDeepLinkCustomParamKey</key>
<string>変更したいキー名</string>
Implementation on Android¶
Using a custom URL Scheme¶
To use this feature with a custom URL Scheme, call deepLinkReceived and pass the URL where you receive the URL.
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Handle the case where the app is launched freshly
handleIntent(getIntent());
}
// Handle the case where the app is already running in the background
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
handleIntent(intent);
}
private void handleIntent(Intent intent) {
// Check whether the Intent action is VIEW (launched from a URL)
if (intent != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String path = uri.getPath();
Repro.deepLinkReceived(getApplication(), uri); // <= Add this line
// Routing
if ("/XXXX".equals(path)) {
...
}
}
}
}
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Handle the case where the app is launched freshly
handleIntent(intent)
}
// Handle the case where the app is already running in the background
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
// Check whether the Intent action is VIEW (launched from a URL)
if (Intent.ACTION_VIEW == intent?.action) {
val uri = intent.data
val path = uri.path
Repro.deepLinkReceived(application, uri) // <= Add this line
// Routing
if (path == "/XXXX") {
...
}
}
}
}
// This section explains the implementation in Android.
// Please change the language to Java or Kotlin.
// This section explains the implementation in Android.
// Please change the language to Java or Kotlin.
Using App Links¶
As with a custom URL Scheme, to use this feature with App Links, call deepLinkReceived and pass the URL where you receive the URL.
Using push notifications¶
If you want to pass a deep link URL when a push notification is opened, use Repro’s Universal Links feature. When the deep link field of the push message (see the image below) matches a Universal Link URL pattern, the URL is automatically passed to deepLinkReceived. No additional implementation is required if the URL pattern is already registered.
Changing the parameter name to be read¶
The parameter key that Repro reads is reproEventKey by default, but you can change this key name.
To change the key name on Android, add the following key and value to the AndroidManifest.xml of your app.
android:name (key) |
android:value (value) |
|---|---|
|
The key name you want to use |
You can add it in XML as follows.
<meta-data
android:name="io.repro.android.RPRDeepLinkCustomParamKey"
android:value="変更したいキー名">
</meta-data>
React Native/Expo/Flutter/Cordova/Monaca/Unity/Cocos2d-x¶
You can implement launching the app via a deep link on this platform as well.
Note that displaying an in-app message on app launch with this feature requires the same implementation as in the native environments (iOS/Android). Check Implementation on iOS and Implementation on Android, and add the processing to AppDelegate on iOS or MainActivity on Android as needed.