Embrace

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.

Types

Link copied to clipboard
public enum AppFramework
The AppFramework that is in use.

Functions

Link copied to clipboard
public void addConnectionQualityListener(@NonNull() ConnectionQualityListener listener)
Registers a ConnectionQualityListener, notifying the listener each time that there is a change in the connection quality.
Link copied to clipboard
public boolean addSessionProperty(    @NonNull() String key,     @NonNull() String value,     boolean permanent)
Adds a property to the current session.
Link copied to clipboard
public void clearAllUserPersonas()
Clears all custom user personas from the user.
Link copied to clipboard
public void clearUserAsPayer()
Clears this user as a paying user.
Link copied to clipboard
public void clearUserEmail()
Clears the currently set user's email address.
Link copied to clipboard
public void clearUserIdentifier()
Clears the currently set user ID.
Link copied to clipboard
public void clearUsername()
Clears the username of the currently logged in user, for example if the user has logged out.
Link copied to clipboard
public void clearUserPersona(@NonNull() String persona)
Clears the custom user persona, if it is set.
Link copied to clipboard
public void disableDebugLogging()
This method disables debug logging.
Link copied to clipboard
public void enableDebugLogging()
This method enables debug logging.
Link copied to clipboard
public static void enableEarlyAnrCapture(@NonNull() Context context)
Starts capturing ANRs before the rest of the Embrace SDK has initialized.
Link copied to clipboard
public static void enableStartupTracing(@NonNull() Context context)
Capture stacktraces during startup to better understand what is happening during startup.
Link copied to clipboard
public void endAppStartup()
public void endAppStartup(@NonNull() Map<String, Object> properties)
Signals that the app has completed startup.
Link copied to clipboard
public void endEvent(@NonNull() String name)
public void endEvent(@NonNull() String name, @Nullable() String identifier)
public void endEvent(@NonNull() String name, @Nullable() Map<String, Object> properties)
public void endEvent(    @NonNull() String name,     @Nullable() String identifier,     @Nullable() Map<String, Object> properties)
Signals the end of an event with the specified name.
Link copied to clipboard
public boolean endFragment(@NonNull() String name)
Log the end of a fragment.
Link copied to clipboard
public synchronized void endSession()
public synchronized void endSession(boolean clearUserInfo)
Ends the current session and starts a new one.
Link copied to clipboard
public ConfigService getConfigService()
Link copied to clipboard
public String getDeviceId()
Get the user identifier assigned to the device by Embrace
Link copied to clipboard
public FlutterInternalInterface getFlutterInternalInterface()
Gets the FlutterInternalInterface that should be used as the sole source of communication with the Android SDK for Flutter.
Link copied to clipboard
public static Embrace getInstance()
Gets the singleton instance of the Embrace SDK.
Link copied to clipboard
public LocalConfig getLocalConfig()
Link copied to clipboard
public ReactNativeInternalInterface getReactNativeInternalInterface()
Gets the ReactNativeInternalInterface that should be used as the sole source of communication with the Android SDK for React Native.
Link copied to clipboard
public Map<String, String> getSessionProperties()
Retrieves a map of the current session properties.
Link copied to clipboard
public String getTraceIdHeader()
Retrieve the HTTP request header to extract trace ID from.
Link copied to clipboard
public UnityInternalInterface getUnityInternalInterface()
Gets the UnityInternalInterface that should be used as the sole source of communication with the Android SDK for Unity.
Link copied to clipboard
public void initUnityConnection(@NotNull() AndroidToUnityCallback callback)
Sets up connection from Android to Unity.
Link copied to clipboard
public boolean isStarted()
Whether or not the SDK has been started.
Link copied to clipboard
public void logBreadcrumb(@NonNull() String message)
Logs a breadcrumb.
Link copied to clipboard
public void logDartError(    @Nullable() String stack,     @Nullable() String message,     @Nullable() String context,     @Nullable() String library)
Logs a Dart error to the Embrace SDK - this is not intended for public use.
Link copied to clipboard
public void logDartErrorWithType(    @Nullable() String stack,     @Nullable() String message,     @Nullable() String context,     @Nullable() String library,     @Nullable() String errorType)
Logs a Dart error to the Embrace SDK - this is not intended for public use.
Link copied to clipboard
public void logError(@NonNull() String message)
public void logError(@NonNull() Throwable e)
public void logError(@NonNull() String message, @Nullable() Map<String, Object> properties)
public void logError(@NonNull() Throwable e, @Nullable() Map<String, Object> properties)
public void logError(    @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot)
public void logError(    @NonNull() Throwable e,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot)
public void logError(    @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot,     @Nullable() String javascriptStackTrace)
public void logError(    @NonNull() Throwable e,     @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot)
public void logError(    @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot,     @Nullable() String javascriptStackTrace,     boolean isException)
Remotely logs a message at ERROR level.
Link copied to clipboard
public void logHandledException(@NonNull() Throwable throwable, @NonNull() LogType type)
public void logHandledException(    @NonNull() Throwable throwable,     @NonNull() LogType type,     @NonNull() Array<StackTraceElement> customStackTrace)
public void logHandledException(    @NonNull() Throwable throwable,     @NonNull() LogType type,     @NonNull() Map<String, Object> properties)
public void logHandledException(    @NonNull() Throwable throwable,     @NonNull() LogType type,     @Nullable() Map<String, Object> properties,     @Nullable() Array<StackTraceElement> customStackTrace,     boolean takeScreenshot)
Logs a handled exception to the Embrace.io API for aggregation and viewing on the dashboard.
Link copied to clipboard
public void logInfo(@NonNull() String message)
public void logInfo(@NonNull() String message, @Nullable() Map<String, Object> properties)
Remotely logs a message at INFO level.
Link copied to clipboard
public void logInternalError(@Nullable() String message, @Nullable() String details)
Logs an internal error to the Embrace SDK - this is not intended for public use.
Link copied to clipboard
public void logNetworkCall(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     int statusCode,     long startTime,     long endTime,     long bytesSent,     long bytesReceived)
public void logNetworkCall(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     int statusCode,     long startTime,     long endTime,     long bytesSent,     long bytesReceived,     @Nullable() String traceId)
public void logNetworkCall(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     int statusCode,     long startTime,     long endTime,     long bytesSent,     long bytesReceived,     @Nullable() String traceId,     @Nullable() NetworkCaptureData networkCaptureData)
Logs the fact that a network call occurred.
Link copied to clipboard
public void logNetworkClientError(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     long startTime,     long endTime,     @NonNull() String errorType,     @NonNull() String errorMessage)
public void logNetworkClientError(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     long startTime,     long endTime,     @NonNull() String errorType,     @NonNull() String errorMessage,     @Nullable() String traceId)
public void logNetworkClientError(    @NonNull() String url,     @NonNull() HttpMethod httpMethod,     long startTime,     long endTime,     @NonNull() String errorType,     @NonNull() String errorMessage,     @Nullable() String traceId,     @Nullable() NetworkCaptureData networkCaptureData)
Logs the fact that an exception was thrown when attempting to make a network call.
Link copied to clipboard
public void logNetworkRequest(@NonNull() EmbraceNetworkRequest request)
public void logNetworkRequest(@NonNull() EmbraceNetworkRequestV2 request)
public void logNetworkRequest(    @NonNull() String url,     int httpMethod,     long startTime,     long endTime,     int bytesSent,     int bytesReceived,     int statusCode,     @Nullable() String error)
Manually logs a network request.
Link copied to clipboard
public void logPushNotification(    @Nullable() String title,     @Nullable() String body,     @Nullable() String topic,     @Nullable() String id,     @Nullable() Integer notificationPriority,     @NotNull() Integer messageDeliveredPriority,     @NotNull() PushNotificationBreadcrumb.NotificationType notificationType)
public void logPushNotification(    @Nullable() String title,     @Nullable() String body,     @Nullable() String topic,     @Nullable() String id,     @Nullable() Integer notificationPriority,     @NotNull() Integer messageDeliveredPriority,     @NotNull() Boolean isNotification,     @NotNull() Boolean hasData)
Saves captured push notification information into session payload
Link copied to clipboard
public void logRnAction(    @NonNull() String name,     long startTime,     long endTime,     @NonNull() Map<String, Object> properties,     int bytesSent,     @NonNull() String output)
Logs a React Native Redux Action.
Link copied to clipboard
public void logRnView(@NonNull() String screen)
Logs the fact that a particular view was entered.
Link copied to clipboard
public void logUnhandledJsException(    @NonNull() String name,     @NonNull() String message,     @Nullable() String type,     @Nullable() String stacktrace)
Logs a javascript unhandled exception.
Link copied to clipboard
public void logUnhandledUnityException(@NonNull() String message, @Nullable() String stacktrace)
Logs a Unity unhandled exception.
Link copied to clipboard
public void logWarning(@NonNull() String message)
public void logWarning(@NonNull() String message, @Nullable() Map<String, Object> properties)
public void logWarning(    @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot)
public void logWarning(    @NonNull() String message,     @Nullable() Map<String, Object> properties,     boolean allowScreenshot,     @Nullable() String javascriptStackTrace)
Remotely logs a message at WARN level.
Link copied to clipboard
public void removeConnectionQualityListener(@NonNull() ConnectionQualityListener listener)
Removes a registered ConnectionQualityListener, suspending connection quality notifications.
Link copied to clipboard
public boolean removeSessionProperty(@NonNull() String key)
Removes a property from the current session.
Link copied to clipboard
public void sampleCurrentThreadDuringAnrs()
Link copied to clipboard
public boolean setAppId(@NonNull() String appId)
Sets a custom app ID that overrides the one specified at build time.
Link copied to clipboard
public void setDartVersion(@Nullable() String version)
Sets the Dart version - this is not intended for public use.
Link copied to clipboard
public void setEmbraceFlutterSdkVersion(@Nullable() String version)
Sets the Embrace Flutter SDK version - this is not intended for public use.
Link copied to clipboard
public void setJavaScriptBundleURL(@NonNull() String url)
Sets the path of the javascript bundle.
Link copied to clipboard
public void setJavaScriptPatchNumber(@NonNull() String number)
Sets javascript patch number.
Link copied to clipboard
public void setLogLevel(@NonNull() EmbraceLogger.Severity severity)
This method sets a logging level, but this logging level is never used.
Link copied to clipboard
public void setProcessStartedByNotification()
Link copied to clipboard
public void setReactNativeSdkVersion(@NonNull() String version)
Sets the Embrace RN SDK version.
Link copied to clipboard
public void setReactNativeVersionNumber(@NonNull() String version)
Sets the react native version number.
Link copied to clipboard
public void setUnityMetaData(@NonNull() String unityVersion, @NonNull() String buildGuid)
Sets the Unity version and Unity build id.
public void setUnityMetaData(    @NonNull() String unityVersion,     @NonNull() String buildGuid,     @Nullable() String unitySdkVersion)
Sets the Unity version, Unity build id and Unity SDK version.
Link copied to clipboard
public void setUserAsPayer()
Sets this user as a paying user.
Link copied to clipboard
public void setUserEmail(@Nullable() String email)
Sets the current user's email address.
Link copied to clipboard
public void setUserIdentifier(@Nullable() String userId)
Sets the user ID.
Link copied to clipboard
public void setUsername(@Nullable() String username)
Sets the username of the currently logged in user.
Link copied to clipboard
public void setUserPersona(@NonNull() String persona)
Sets a custom user persona.
Link copied to clipboard
public boolean shouldCaptureNetworkBody(@NonNull() String url, @NonNull() String method)
Determine if a network call should be captured based on the network capture rules
Link copied to clipboard
public void start(@NonNull() Context context)
public void start(@NonNull() Context context, boolean enableIntegrationTesting)
public void start(    @NonNull() Context context,     boolean enableIntegrationTesting,     @NonNull() Embrace.AppFramework appFramework)
Starts instrumentation of the Android application using the Embrace SDK.
Link copied to clipboard
public void startEvent(@NonNull() String name)
public void startEvent(@NonNull() String name, @Nullable() String identifier)
public void startEvent(    @NonNull() String name,     @Nullable() String identifier,     boolean allowScreenshot)
public void startEvent(    @NonNull() String name,     @Nullable() String identifier,     @Nullable() Map<String, Object> properties)
public void startEvent(    @NonNull() String name,     @Nullable() String identifier,     boolean allowScreenshot,     @Nullable() Map<String, Object> properties)
Starts an event or 'moment'.
Link copied to clipboard
public boolean startFragment(@NonNull() String name)
Log the start of a fragment.
Link copied to clipboard
public void throwException()
Causes a crash with an exception.