Get Started: Android¶
Install Repro SDK¶
Adding the Repro SDK as a dependency to your project.
Please add our repository URL to the repository search list to your settings.gradle
file as described below. (Older versions of Gradle use the app/build.gradle
file for repository search definitions.)
repositories {
...
maven { url 'https://cdn.reproio.com/android' }
...
}
Please also add the Repro SDK as a dependency as described below to your app/build.gradle
file.
dependencies {
...
implementation 'io.repro:repro-android-sdk:5.20.0'
...
}
Note
'implementation' is not available for versions below Gradle 3.4. Please use 'compile' instead.
To use Repro SDK, your application must have the following android permissions. These permissions are automatically merged into your application. You don't need to add permissions to your application's AndroidManifest.xml
manually.
android.permission.INTERNET
android.permission.ACCESS_NETWORK_STATE
Note
For more details with Manifest Merging, see this article.
MultiDex¶
Android applications (APK) have Dalvik Executable (DEX) format files inside of them as an executable. Due to this DEX file specification, the number of methods a single DEX file can refer to is limited to 65536. This means that if you exceed this limitation by installing Repro SDK, it will cause an error on build and show a message like below (note that the description details of the error may vary depending on the version of the tools you're using).
Error Message:
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Add below to build.gradle of your application to avoid this error.
android {
defaultConfig {
multiDexEnabled true
}
}
Note
See this article for more details of the details or constraints with DEX & MultiDex.
After Repro SDK is installed, proceed to setup Repro.
ProGuard¶
Please set the following rules when applying ProGuard to your application that uses Repro SDK.
-dontwarn io.repro.android.**
-keep class io.repro.android.** { *; }
Note
These ProGuard settings are not needed for the Repro Android SDK version 5.5.1 or higher.
edge-to-edge¶
Repro SDK does not support edge-to-edge.
Therefore, when using Repro with edge-to-edge compatible apps, please note that the design of the status bar and navigation bar may temporarily change from what is set for the app when in-app messages are displayed.
Setup¶
If you haven't implemented your custom Application class, create it and specify its name in AndroidManifest.xml
as follows.
<application android:name="YOUR_APPLICATION_CLASS_NAME">
Start a new session in onCreate
of your Application class.
You can find the YOUR_APP_TOKEN
at SDK Token in SETTINGS > PROJECT SETTINGS > Credentials on the management screen.
import io.repro.android.Repro;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
...
// Setup Repro
Repro.setup(this, "YOUR_APP_TOKEN");
...
}
}
Information collected by the SDK will be uploaded to the server periodically.
Track event¶
Targeting the right group of users is critical to effectively make analyses or marketing campaigns. By keeping track of user behavior as events, you will be able to choose the right group of users according to your purpose from the dashboard.
Example of targeting user group with events:
If you don't exactly know which events to track in your app, we recommend you to start from tracking the event when each view is displayed.
Example:
@implementation MainViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[Repro track:@"MainViewController" properties:nil];
...
}
class MainViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Repro.track(event: "MainViewController", properties: [:])
...
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
Repro.track("MainActivity");
...
}
}
#include "ReproCpp.h"
...
ReproCpp::track("Initialized");
Repro.Track ("Initialized");
// Will be written later
class MainScreen extends React.Component {
componentDidMount() {
Repro.track("MainScreen", {});
}
...
}
import Repro from 'react-native-repro';
...
Repro.track("MainScreen", {});
import 'package:repro_flutter/repro.dart';
...
await Repro.track("Initialized");
Set User ID¶
The analytics results you will see in Repro are aggregated per each user. By setting the User ID, you gain the advantages below:
Identify the same user across multiple devices
Target campaigns more accurately
Please see here for more details.
Send push notifications¶
You can send push notifications from Repro's dashboard as well as using the API. Please refer to this document when implementing push notification.
Next...¶
For more details of other available features, please see below.