Session Reporting

Session Reporting #

Now that you’ve added the Embrace SDK to your project and can login to the Embrace dashboard, you’re ready to create your first session. Here are the steps you’ll be taking to create your first session.

  1. Import Embrace
  2. Add a start call to the Embrace SDK
  3. End the Startup Moment
  4. Build and run the application
  5. Trigger a session upload

Import Embrace #

Start by importing the Embrace native SDK in the file that applies for each platform.

Open the AppDelegate.m file (usually located at <project root>/ios/<MyApp>/AppDelegate.m) and import Embrace.

#import <Embrace/Embrace.h>

Open the file (usually located at <project root>/android/app/src/main/java/com/<MyApp>/ and import Embrace.

If you used the setup script mentioned on the Adding the Embrace SDK page, this change has already been made for you.

Add the Start Call #

After importing Embrace, you’ll update the same files that you edited in the previous step make a call to the Embrace SDK to start capturing data.

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *) launchOptions
    // Replace with your APP_ID, which is a 5-character value, e.g. "aBc45"
    [[Embrace sharedInstance] startWithKey:@"APP_ID" launchOptions: launchOptions framework:EMBAppFrameworkReactNative];
    return YES;
public class MainApplication extends Application implements ReactApplication {

    public void onCreate() {
        // Add this line right after the super.onCreate();
        Embrace.getInstance().start(this, false, Embrace.AppFramework.REACT_NATIVE);

End the Startup Moment #

Embrace automatically starts the startup moment when your application launches. You’ll learn more about moments in Performance Monitoring guide. For now, you can think of the startup moment as a timer that measures how long it took your application to launch. Although in both Android and iOS the moment is started automatically, ending it is platform specific.

For Android, the SDK will end the moment automatically. To end the startup moment when you React component mounts, see the Android guide to prevent the moment from ending automatically.

The iOS SDK does not end the moment automatically.

In either platform, you can end the startup moment when your application mounts.

import {endAppStartup} from 'react-native-embrace';

export default class App extends Component {
  componentDidMount() {

End the startup moment as soon as your users are able to interact with the application.

Build and Run the Application #

Now you’re ready to build and run the application. Launch the application how you usually would during development.

If you encounter any errors, please get in touch on Slack and we can assist you.

Trigger a Session Upload #

To trigger a session upload, simply stop the application by either force killing it or using the stop button in either Xcode for iOS or Android Studio for Android. Now run the application again. This second launch will upload the previous session immediately. Refresh the dashboard in your browser and you should now see that you’ve moved on to the next step.

Congratulations! At this point you’ve completed a basic integration of Embrace. Embrace is already collecting interesting data from your application. You can see this data by browsing around the timeline page for the session you just captured.

Up next, you’ll be learning about uploading crash reports.

Upload Crash Report