Package 

Class Embrace

  • All Implemented Interfaces:
    io.embrace.android.embracesdk.BugShakeApi , io.embrace.android.embracesdk.EmbraceAndroidApi , io.embrace.android.embracesdk.EmbraceApi , io.embrace.android.embracesdk.LogsApi , io.embrace.android.embracesdk.MomentsApi , io.embrace.android.embracesdk.NetworkRequestApi , io.embrace.android.embracesdk.SessionApi , io.embrace.android.embracesdk.UserApi , io.embrace.android.embracesdk.spans.TracingApi

    
    public final class Embrace
     implements EmbraceAndroidApi
                        

    Entry point for the SDK. This class is part of the Embrace Public API.

    Contains a singleton instance of itself, and is used for initializing the SDK.

    • Method Detail

      • start

         void start(@NonNull() Context context)

        Starts instrumentation of the Android application using the Embrace SDK. This should becalled during creation of the application, as early as possible.

        See Embrace Docs forintegration instructions. For compatibility with other networking SDKs such as Akamai,the Embrace SDK must be initialized after any other SDK.

        Parameters:
        context - an instance of the application context
      • start

         void start(@NonNull() Context context, boolean enableIntegrationTesting)

        Starts instrumentation of the Android application using the Embrace SDK. This should becalled during creation of the application, as early as possible.

        See Embrace Docs forintegration instructions. For compatibility with other networking SDKs such as Akamai,the Embrace SDK must be initialized after any other SDK.

        Parameters:
        context - an instance of context
        enableIntegrationTesting - if true, debug sessions (those which are not part of arelease APK) will go to the live integration testing tabof the dashboard.
      • start

         void start(@NonNull() Context context, boolean enableIntegrationTesting, @NonNull() Embrace.AppFramework appFramework)

        Starts instrumentation of the Android application using the Embrace SDK. This should becalled during creation of the application, as early as possible.

        See Embrace Docs forintegration instructions. For compatibility with other networking SDKs such as Akamai,the Embrace SDK must be initialized after any other SDK.

        Parameters:
        context - an instance of context
        enableIntegrationTesting - if true, debug sessions (those which are not part of arelease APK) will go to the live integration testing tabof the dashboard.
      • isStarted

         boolean isStarted()

        Whether or not the SDK has been started.

      • setAppId

         boolean setAppId(@NonNull() String appId)

        Sets a custom app ID that overrides the one specified at build time. Must be called beforethe SDK is started.

        Parameters:
        appId - custom app ID
      • startMoment

         void startMoment(@NonNull() String name)

        Starts a 'moment'. Moments are used for encapsulating particular activities withinthe app, such as a user adding an item to their shopping cart.

        The length of time a moment takes to execute is recorded.

        Parameters:
        name - a name identifying the moment
      • startMoment

         void startMoment(@NonNull() String name, @Nullable() String identifier)

        Starts a 'moment'. Moments are used for encapsulating particular activities withinthe app, such as a user adding an item to their shopping cart.

        The length of time a moment takes to execute is recorded.

        Parameters:
        name - a name identifying the moment
        identifier - an identifier distinguishing between multiple moments with the same name
      • startMoment

         void startMoment(@NonNull() String name, @Nullable() String identifier, @Nullable() Map<String, Object> properties)

        Starts a 'moment'. Moments are used for encapsulating particular activities withinthe app, such as a user adding an item to their shopping cart.

        The length of time a moment takes to execute is recorded

        Parameters:
        name - a name identifying the moment
        identifier - an identifier distinguishing between multiple moments with the same name
        properties - custom key-value pairs to provide with the moment
      • endMoment

         void endMoment(@NonNull() String name)

        Signals the end of a moment with the specified name.

        The duration of the moment is computed.

        Parameters:
        name - the name of the moment to end
      • endMoment

         void endMoment(@NonNull() String name, @Nullable() String identifier)

        Signals the end of a moment with the specified name.

        The duration of the moment is computed.

        Parameters:
        name - the name of the moment to end
        identifier - the identifier of the moment to end, distinguishing between moments with the same name
      • endMoment

         void endMoment(@NonNull() String name, @Nullable() Map<String, Object> properties)

        Signals the end of a moment with the specified name.

        The duration of the moment is computed.

        Parameters:
        name - the name of the moment to end
        properties - custom key-value pairs to provide with the moment
      • endMoment

         void endMoment(@NonNull() String name, @Nullable() String identifier, @Nullable() Map<String, Object> properties)

        Signals the end of a moment with the specified name.

        The duration of the moment is computed.

        Parameters:
        name - the name of the moment to end
        identifier - the identifier of the moment to end, distinguishing between moments with the same name
        properties - custom key-value pairs to provide with the moment
      • endAppStartup

         void endAppStartup()

        Signals that the app has completed startup.

      • endAppStartup

         void endAppStartup(@NonNull() Map<String, Object> properties)

        Signals that the app has completed startup.

        Parameters:
        properties - properties to include as part of the startup moment
      • logInfo

         void logInfo(@NonNull() String message)

        Remotely logs a message at INFO level. These log messages will appear as part of the sessiontimeline, and can be used to describe what was happening at a particular time within the app.

        Parameters:
        message - the message to remotely log
      • logWarning

         void logWarning(@NonNull() String message)

        Remotely logs a message at WARN level. These log messages will appear as part of the sessiontimeline, and can be used to describe what was happening at a particular time within the app.

        Parameters:
        message - the message to remotely log
      • logError

         void logError(@NonNull() String message)

        Remotely logs a message at ERROR level. These log messages will appear as part of the sessiontimeline, and can be used to describe what was happening at a particular time within the app.

        Parameters:
        message - the message to remotely log
      • addBreadcrumb

         void addBreadcrumb(@NonNull() String message)

        Adds a breadcrumb.

        Breadcrumbs track a user's journey through the application and will be shown on the timeline.

        Parameters:
        message - the name of the breadcrumb to log
      • logMessage

         void logMessage(@NonNull() String message, @NonNull() Severity severity)

        Remotely logs a message at the given severity level. These log messages will appear as part of the sessiontimeline, and can be used to describe what was happening at a particular time within the app.

        Parameters:
        message - the message to remotely log
        severity - the severity level of the log message
      • logMessage

         void logMessage(@NonNull() String message, @NonNull() Severity severity, @Nullable() Map<String, Object> properties)

        Remotely logs a message at the given severity level. These log messages will appear as part of the sessiontimeline, and can be used to describe what was happening at a particular time within the app.

        Parameters:
        message - the message to remotely log
        severity - the severity level of the log message
        properties - the properties to attach to the log message
      • logException

         void logException(@NonNull() Throwable throwable)

        Remotely logs a Throwable/Exception at ERROR level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        throwable - the throwable to remotely log
      • logException

         void logException(@NonNull() Throwable throwable, @NonNull() Severity severity)

        Remotely logs a Throwable/Exception at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        throwable - the throwable to remotely log
        severity - the severity level of the log message
      • logException

         void logException(@NonNull() Throwable throwable, @NonNull() Severity severity, @Nullable() Map<String, Object> properties)

        Remotely logs a Throwable/Exception at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        throwable - the throwable to remotely log
        severity - the severity level of the log message
        properties - custom key-value pairs to include with the log message
      • logException

         void logException(@NonNull() Throwable throwable, @NonNull() Severity severity, @Nullable() Map<String, Object> properties, @Nullable() String message)

        Remotely logs a Throwable/Exception at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        throwable - the throwable to remotely log
        severity - the severity level of the log message
        properties - custom key-value pairs to include with the log message
        message - the message to remotely log instead of the throwable message
      • logCustomStacktrace

         void logCustomStacktrace(@NonNull() Array<StackTraceElement> stacktraceElements)

        Remotely logs a custom stacktrace at ERROR level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        stacktraceElements - the stacktrace to remotely log
      • logCustomStacktrace

         void logCustomStacktrace(@NonNull() Array<StackTraceElement> stacktraceElements, @NonNull() Severity severity)

        Remotely logs a custom stacktrace at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        stacktraceElements - the stacktrace to remotely log
        severity - the severity level of the log message
      • logCustomStacktrace

         void logCustomStacktrace(@NonNull() Array<StackTraceElement> stacktraceElements, @NonNull() Severity severity, @Nullable() Map<String, Object> properties)

        Remotely logs a custom stacktrace at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        stacktraceElements - the stacktrace to remotely log
        severity - the severity level of the log message
        properties - custom key-value pairs to include with the log message
      • logCustomStacktrace

         void logCustomStacktrace(@NonNull() Array<StackTraceElement> stacktraceElements, @NonNull() Severity severity, @Nullable() Map<String, Object> properties, @Nullable() String message)

        Remotely logs a custom stacktrace at given severity level. These log messages and stacktraceswill appear as part of the session timeline, and can be used to describe what was happeningat a particular time within the app.

        Parameters:
        stacktraceElements - the stacktrace to remotely log
        severity - the severity level of the log message
        properties - custom key-value pairs to include with the log message
        message - the message to remotely log instead of the throwable message
      • endSession

         synchronized void endSession(boolean clearUserInfo)
      • startView

         boolean startView(@NonNull() String name)

        Records that a view 'started'. You should call this when your app starts displaying anactivity, a fragment, a screen, or any custom UI element, and you want to capture abreadcrumb that this happens.

        A matching call to endView must be made when the view is no longerdisplayed.

        A maximum of 100 breadcrumbs will be recorded per session, with a maximum length of 256characters per view name.

        Parameters:
        name - the name of the view to log
      • endView

         boolean endView(@NonNull() String name)

        Records that a view 'ended'. You should call this when your app stops displaying anactivity, a fragment, a screen, or any custom UI element, and you want to capture abreadcrumb that this happens.

        A matching call to startView must be made when the view is firstdisplayed, or no breadcrumb will be logged.

        A maximum of 100 breadcrumbs will be recorded per session, with a maximum length of 256characters per view name.

        Parameters:
        name - the name of the view to log
      • logRnView

         void logRnView(@NonNull() String screen)

        Logs the fact that a particular view was entered.

        If the previously logged view has the same name, a duplicate view breadcrumb will not belogged.

        Parameters:
        screen - the name of the view to log
      • getReactNativeInternalInterface

        @Nullable() ReactNativeInternalInterface getReactNativeInternalInterface()

        Gets the ReactNativeInternalInterface that should be used as the sole source ofcommunication with the Android SDK for React Native.

      • getUnityInternalInterface

        @Nullable() UnityInternalInterface getUnityInternalInterface()

        Gets the UnityInternalInterface that should be used as the sole source ofcommunication with the Android SDK for Unity.

      • getFlutterInternalInterface

        @Nullable() FlutterInternalInterface getFlutterInternalInterface()

        Gets the FlutterInternalInterface that should be used as the sole source ofcommunication with the Android SDK for Flutter.

      • logPushNotification

         void logPushNotification(@Nullable() String title, @Nullable() String body, @Nullable() String topic, @Nullable() String id, @Nullable() Integer notificationPriority, @NonNull() Integer messageDeliveredPriority, @NonNull() Boolean isNotification, @NonNull() Boolean hasData)

        Saves captured push notification information into session payload

        Parameters:
        title - the title of the notification as a string (or null)
        body - the body of the notification as a string (or null)
        topic - the notification topic (if a user subscribed to one), or null
        id - A unique ID identifying the message
        notificationPriority - the notificationPriority of the message (as resolved on the device)
        messageDeliveredPriority - the priority of the message (as resolved on the server)
        isNotification - if it is a notification message.
        hasData - if the message contains payload data.
      • shouldCaptureNetworkBody

         boolean shouldCaptureNetworkBody(@NonNull() String url, @NonNull() String method)

        Determine if a network call should be captured based on the network capture rules

        Parameters:
        url - the url of the network call
        method - the method of the network call
      • trackWebViewPerformance

         void trackWebViewPerformance(@NonNull() String tag, @NonNull() ConsoleMessage consoleMessage)

        Listen to performance-tracking JavaScript previously embedded in the website's code.The WebView being tracked must have JavaScript enabled.

        Parameters:
        tag - a name used to identify the WebView being tracked
        consoleMessage - the console message collected from the WebView
      • trackWebViewPerformance

         void trackWebViewPerformance(@NonNull() String tag, @NonNull() String message)

        Listen to performance-tracking JavaScript previously embedded in the website's code.The WebView being tracked must have JavaScript enabled.

        Parameters:
        tag - a name used to identify the WebView being tracked
        message - the console message collected from the WebView
      • getCurrentSessionId

        @Nullable() String getCurrentSessionId()

        Get the ID for the current session.Returns null if a session has not been started yet or the SDK hasn't been initialized.