Get Started: Flutter¶
Install Flutter Package¶
Add repro_flutter
to your pubspec.yaml
.
dependencies:
flutter:
sdk: flutter
...
repro_flutter: ^3.16.1
Note
From Flutter Package version 3.0.0 and onward, we fully support Sound null safety. Therefore applications that have not yet transitioned to Sound null safety must use a version below 3.0.0.
Flutter Package versions 3.14.0 and later removes the Android v1 embedding process. Therefore, if you are installing the package in an application that uses Android v1 embedding, please use version 3.14.0 or lower.
Run the following command to install Repro Flutter plugin.
$ flutter packages get
Introduce plugin into iOS project¶
Run the following command in the root directory of your project.
$ cd ios
$ pod install
Introduce plugin into Android project¶
Add dependency to Repro Flutter Plugin in your app/build.gradle
.
dependencies {
implementation 'io.repro:repro-android-sdk:5.20.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
In case your app build process uses Android Gradle Plugin 8.0 and above¶
Depending on the version of your Android Gradle Plugin, error messages as shown below may occur.
A problem occurred configuring project ':repro_flutter'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
> Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
If such an error occurs, open the build.gradle
file in your Flutter Android project and under the allprojects
section please add the code below.
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
project.android {
if (namespace == null) {
namespace project.group
}
}
}
}
}
Setup¶
iOS¶
Import Repro
in your AppDelegate
and then start a new session in application:didFinishLaunchingWithOptions:
, by calling Repro#setup
.
You can find the YOUR_APP_TOKEN
at SDK Token in SETTINGS > PROJECT SETTINGS > Credentials on the management screen.
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
[Repro setup:@"YOUR_APP_TOKEN"];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Android¶
Create a custom Application
class extending from android.app.Application
. If you've done this before for the other reasons, you have not to create it.
package your.package.name;
import android.app.Application;
import io.repro.android.Repro;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
}
}
Modify your custom Application class' name in AndroidManifest.xml
as follows.
<application
- android:name="${applicationName}"
+ android:name="your.package.name.MyApplication"
android:label="repro_integration_test"
android:icon="@mipmap/ic_launcher">
Call Repro.setup
in onCreate
of your custom Application
class and start a new session.
public void onCreate() {
super.onCreate();
Repro.setup(this, "YOUR_APP_TOKEN");
}
You can find the YOUR_APP_TOKEN
at SDK Token in SETTINGS > PROJECT SETTINGS > Credentials on the management screen.
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.