public final class Embrace
extends java.lang.Object
Contains a singleton instance of itself, and is used for initializing the SDK.
| Modifier and Type | Class and Description |
|---|---|
static class |
Embrace.AppFramework |
| Constructor and Description |
|---|
Embrace() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionQualityListener(ConnectionQualityListener listener)
Registers a
ConnectionQualityListener, notifying the listener each time that there is
a change in the connection quality. |
boolean |
addSessionProperty(java.lang.String key,
java.lang.String value,
boolean permanent) |
void |
clearAllUserPersonas()
Clears all custom user personas from the user.
|
void |
clearUserAsPayer()
Clears this user as a paying user.
|
void |
clearUserEmail()
Clears the currently set user's email address.
|
void |
clearUserIdentifier()
Clears the currently set user ID.
|
void |
clearUsername()
Clears the username of the currently logged in user, for example if the user has logged out.
|
void |
clearUserPersona(java.lang.String persona)
Clears the custom user persona, if it is set.
|
void |
disableDebugLogging()
This method disables debug logging.
|
void |
enableDebugLogging()
This method enables debug logging.
|
void |
endAppStartup()
Signals that the app has completed startup.
|
void |
endAppStartup(java.util.Map<java.lang.String,java.lang.Object> properties)
Signals that the app has completed startup.
|
void |
endEvent(java.lang.String name)
Signals the end of an event with the specified name.
|
void |
endEvent(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> properties)
Signals the end of an event with the specified name.
|
void |
endEvent(java.lang.String name,
java.lang.String identifier)
Signals the end of an event with the specified name.
|
void |
endEvent(java.lang.String name,
java.lang.String identifier,
java.util.Map<java.lang.String,java.lang.Object> properties)
Signals the end of an event with the specified name.
|
boolean |
endFragment(java.lang.String name)
Log the end of a fragment.
|
void |
endSession()
Ends the current session and starts a new one.
|
void |
endSession(boolean clearUserInfo)
Ends the current session and starts a new one.
|
java.lang.String |
getDeviceId()
Get the user identifier assigned to the device by Embrace
|
static Embrace |
getInstance()
Gets the singleton instance of the Embrace SDK.
|
LocalConfig |
getLocalConfig() |
java.util.Map<java.lang.String,java.lang.String> |
getSessionProperties() |
java.lang.String |
getTraceIdHeader()
Retrieve the HTTP request header to extract trace ID from.
|
boolean |
isStarted()
Whether or not the SDK has been started.
|
void |
logBreadcrumb(java.lang.String message)
Logs a breadcrumb.
|
void |
logError(java.lang.String message)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace,
boolean isException)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.Throwable e)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.Throwable e,
java.util.Map<java.lang.String,java.lang.Object> properties)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.Throwable e,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
Remotely logs a message at ERROR level.
|
void |
logError(java.lang.Throwable e,
java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
Remotely logs a message at ERROR level.
|
void |
logInfo(java.lang.String message)
Remotely logs a message at INFO level.
|
void |
logInfo(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
Remotely logs a message at INFO level.
|
void |
logNetworkCall(java.lang.String url,
HttpMethod httpMethod,
int statusCode,
long startTime,
long endTime,
long bytesSent,
long bytesReceived)
Logs the fact that a network call occurred.
|
void |
logNetworkCall(java.lang.String url,
HttpMethod httpMethod,
int statusCode,
long startTime,
long endTime,
long bytesSent,
long bytesReceived,
java.lang.String traceId)
Logs the fact that a network call occurred.
|
void |
logNetworkClientError(java.lang.String url,
HttpMethod httpMethod,
long startTime,
long endTime,
java.lang.String errorType,
java.lang.String errorMessage)
Logs the fact that an exception was thrown when attempting to make a network call.
|
void |
logNetworkClientError(java.lang.String url,
HttpMethod httpMethod,
long startTime,
long endTime,
java.lang.String errorType,
java.lang.String errorMessage,
java.lang.String traceId)
Logs the fact that an exception was thrown when attempting to make a network call.
|
void |
logNetworkRequest(EmbraceNetworkRequest request)
Manually log a network request.
|
void |
logNetworkRequest(EmbraceNetworkRequestV2 request)
Manually log a network request.
|
void |
logNetworkRequest(java.lang.String url,
int httpMethod,
long startTime,
long endTime,
int bytesSent,
int bytesReceived,
int statusCode,
java.lang.String error)
Manually log a network request.
|
void |
logUnhandledJsException(java.lang.String name,
java.lang.String message,
java.lang.String type,
java.lang.String stacktrace)
Logs a javascript unhandled exception.
|
void |
logWarning(java.lang.String message)
Remotely logs a message at WARN level.
|
void |
logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
Remotely logs a message at WARN level.
|
void |
logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
Remotely logs a message at WARN level.
|
void |
logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace)
Remotely logs a message at WARN level.
|
void |
removeConnectionQualityListener(ConnectionQualityListener listener)
Removes a registered
ConnectionQualityListener, suspending connection quality
notifications. |
boolean |
removeSessionProperty(java.lang.String key) |
boolean |
setAppId(java.lang.String appId)
Sets a custom app ID that overrides the one specified at build time.
|
void |
setJavaScriptBundleURL(java.lang.String url)
Sets the path of the javascript bundle.
|
void |
setJavaScriptPatchNumber(java.lang.String number)
Sets javascript patch number.
|
void |
setLogLevel(EmbraceLogger.Severity severity)
Deprecated.
as the log level is never used. Use
EmbraceLogger. |
void |
setReactNativeVersionNumber(java.lang.String version)
Sets the react native version number.
|
void |
setUnityMetaData(java.lang.String unityVersion,
java.lang.String buildGUID)
Sets the Unity version and Unity build id.
|
void |
setUserAsPayer()
Sets this user as a paying user.
|
void |
setUserEmail(java.lang.String email)
Sets the current user's email address.
|
void |
setUserIdentifier(java.lang.String userId)
Sets the user ID.
|
void |
setUsername(java.lang.String username)
Sets the username of the currently logged in user.
|
void |
setUserPersona(java.lang.String persona)
Sets a custom user persona.
|
void |
start(android.content.Context context)
Starts instrumentation of the Android application using the Embrace SDK.
|
void |
start(android.content.Context context,
boolean enableIntegrationTesting)
Starts instrumentation of the Android application using the Embrace SDK.
|
void |
start(android.content.Context context,
boolean enableIntegrationTesting,
Embrace.AppFramework appFramework)
Starts instrumentation of the Android application using the Embrace SDK.
|
void |
startEvent(java.lang.String name)
Starts an event or 'moment'.
|
void |
startEvent(java.lang.String name,
java.lang.String identifier)
Starts an event or 'moment'.
|
void |
startEvent(java.lang.String name,
java.lang.String identifier,
boolean allowScreenshot)
Starts an event or 'moment'.
|
void |
startEvent(java.lang.String name,
java.lang.String identifier,
boolean allowScreenshot,
java.util.Map<java.lang.String,java.lang.Object> properties)
Starts an event or 'moment'.
|
void |
startEvent(java.lang.String name,
java.lang.String identifier,
java.util.Map<java.lang.String,java.lang.Object> properties)
Starts an event or 'moment'.
|
boolean |
startFragment(java.lang.String name)
Log the start of a fragment.
|
void |
throwException()
Causes a crash with an exception.
|
public static Embrace getInstance()
public void start(android.content.Context context)
See Embrace Docs for integration instructions. For compatibility with other networking SDKs such as Akamai, the Embrace SDK must be initialized after any other SDK.
context - an instance of the application contextpublic void start(android.content.Context context,
boolean enableIntegrationTesting)
See Embrace Docs for integration instructions. For compatibility with other networking SDKs such as Akamai, the Embrace SDK must be initialized after any other SDK.
context - an instance of contextenableIntegrationTesting - if true, debug sessions (those which are not part of a
release APK) will go to the live integration testing tab
of the dashboard. If false, they will appear in 'recent
sessions'.public void start(android.content.Context context,
boolean enableIntegrationTesting,
Embrace.AppFramework appFramework)
See Embrace Docs for integration instructions. For compatibility with other networking SDKs such as Akamai, the Embrace SDK must be initialized after any other SDK.
context - an instance of contextenableIntegrationTesting - if true, debug sessions (those which are not part of a
release APK) will go to the live integration testing tab
of the dashboard. If false, they will appear in 'recent
sessions'.public boolean isStarted()
public boolean setAppId(java.lang.String appId)
appId - custom app ID@Deprecated public void setLogLevel(EmbraceLogger.Severity severity)
EmbraceLogger.severity - the severitypublic void enableDebugLogging()
public void disableDebugLogging()
public void setUserIdentifier(java.lang.String userId)
userId - the unique identifier for the userpublic void clearUserIdentifier()
public void setUserEmail(java.lang.String email)
email - the email address of the current userpublic void clearUserEmail()
public void setUserAsPayer()
public void clearUserAsPayer()
public void setUserPersona(java.lang.String persona)
persona - the persona to setpublic void clearUserPersona(java.lang.String persona)
persona - the persona to clearpublic void clearAllUserPersonas()
public boolean addSessionProperty(java.lang.String key,
java.lang.String value,
boolean permanent)
public boolean removeSessionProperty(java.lang.String key)
public java.util.Map<java.lang.String,java.lang.String> getSessionProperties()
public void setUsername(java.lang.String username)
username - the username to setpublic void clearUsername()
public void startEvent(java.lang.String name)
The length of time an event takes to execute is recorded, and a screenshot can be taken if an event is 'late'.
name - a name identifying the eventpublic void startEvent(java.lang.String name,
java.lang.String identifier)
The length of time an event takes to execute is recorded, and a screenshot can be taken if an event is 'late'.
name - a name identifying the eventidentifier - an identifier distinguishing between multiple events with the same namepublic void startEvent(java.lang.String name,
java.lang.String identifier,
boolean allowScreenshot)
The length of time an event takes to execute is recorded, and a screenshot can be taken if an event is 'late'.
name - a name identifying the eventidentifier - an identifier distinguishing between multiple events with the same nameallowScreenshot - true if a screenshot should be taken for a late event, false otherwisepublic void startEvent(java.lang.String name,
java.lang.String identifier,
java.util.Map<java.lang.String,java.lang.Object> properties)
The length of time an event takes to execute is recorded, and a screenshot can be taken if an event is 'late'.
name - a name identifying the eventidentifier - an identifier distinguishing between multiple events with the same nameproperties - custom key-value pairs to provide with the eventpublic void startEvent(java.lang.String name,
java.lang.String identifier,
boolean allowScreenshot,
java.util.Map<java.lang.String,java.lang.Object> properties)
The length of time an event takes to execute is recorded, and a screenshot can be taken if an event is 'late'.
name - a name identifying the eventidentifier - an identifier distinguishing between multiple events with the same nameallowScreenshot - true if a screenshot should be taken for a late event, false otherwiseproperties - custom key-value pairs to provide with the eventpublic void endEvent(java.lang.String name)
The duration of the event is computed, and a screenshot taken (if enabled) if the event was late.
name - the name of the event to endpublic void endEvent(java.lang.String name,
java.lang.String identifier)
The duration of the event is computed, and a screenshot taken (if enabled) if the event was late.
name - the name of the event to endidentifier - the identifier of the event to end, distinguishing between events with the same namepublic void endEvent(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> properties)
The duration of the event is computed, and a screenshot taken (if enabled) if the event was late.
name - the name of the event to endproperties - custom key-value pairs to provide with the eventpublic void endEvent(java.lang.String name,
java.lang.String identifier,
java.util.Map<java.lang.String,java.lang.Object> properties)
The duration of the event is computed, and a screenshot taken (if enabled) if the event was late.
name - the name of the event to endidentifier - the identifier of the event to end, distinguishing between events with the same nameproperties - custom key-value pairs to provide with the eventpublic void endAppStartup()
public void endAppStartup(java.util.Map<java.lang.String,java.lang.Object> properties)
properties - properties to include as part of the startup momentpublic java.lang.String getTraceIdHeader()
public void logNetworkRequest(java.lang.String url,
int httpMethod,
long startTime,
long endTime,
int bytesSent,
int bytesReceived,
int statusCode,
java.lang.String error)
url - the URL of the network callhttpMethod - the int value of the HTTP method of the network callstartTime - the time that the network call startedendTime - the time that the network call was completedbytesSent - the number of bytes sent as part of the network callbytesReceived - the number of bytes returned by the server in response to the network callstatusCode - the status code returned by the servererror - the error returned by the exceptionpublic void logNetworkRequest(EmbraceNetworkRequestV2 request)
request - An EmbraceNetworkRequestV2 with at least the following set: url, method, start time,
end time, and either status code or errorpublic void logNetworkRequest(EmbraceNetworkRequest request)
request - An EmbraceNetworkRequest with at least the following set: url, method, start time,
end time, and either status code or errorpublic void logNetworkCall(java.lang.String url,
HttpMethod httpMethod,
int statusCode,
long startTime,
long endTime,
long bytesSent,
long bytesReceived)
url - the URL of the network callhttpMethod - the HTTP method of the network callstatusCode - the status code returned by the serverstartTime - the time that the network call startedendTime - the time that the network call was completedbytesSent - the number of bytes sent as part of the network callbytesReceived - the number of bytes returned by the server in response to the network callpublic void logNetworkCall(java.lang.String url,
HttpMethod httpMethod,
int statusCode,
long startTime,
long endTime,
long bytesSent,
long bytesReceived,
java.lang.String traceId)
url - the URL of the network callhttpMethod - the HTTP method of the network callstatusCode - the status code returned by the serverstartTime - the time that the network call startedendTime - the time that the network call was completedbytesSent - the number of bytes sent as part of the network callbytesReceived - the number of bytes returned by the server in response to the network calltraceId - the optional trace id that can be used to trace a particular requestpublic void logNetworkClientError(java.lang.String url,
HttpMethod httpMethod,
long startTime,
long endTime,
java.lang.String errorType,
java.lang.String errorMessage)
These are client-side exceptions and not server-side exceptions, such as a DNS error or failure to connect to the remote server.
url - the URL of the network callhttpMethod - the HTTP method of the network callstartTime - the time that the network call startedendTime - the time that the network call was completederrorType - the type of the exceptionerrorMessage - the message returned by the exceptionpublic void logNetworkClientError(java.lang.String url,
HttpMethod httpMethod,
long startTime,
long endTime,
java.lang.String errorType,
java.lang.String errorMessage,
java.lang.String traceId)
These are client-side exceptions and not server-side exceptions, such as a DNS error or failure to connect to the remote server.
url - the URL of the network callhttpMethod - the HTTP method of the network callstartTime - the time that the network call startedendTime - the time that the network call was completederrorType - the type of the exceptionerrorMessage - the message returned by the exceptiontraceId - the optional trace id that can be used to trace a particular requestpublic void logInfo(java.lang.String message)
message - the message to remotely logpublic void logInfo(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
message - the message to remotely logproperties - custom key-value pairs to include with the log messagepublic void logWarning(java.lang.String message)
message - the message to remotely logpublic void logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
message - the message to remotely logproperties - custom key-value pairs to include with the log messagepublic void logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
message - the message to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisepublic void logWarning(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace)
message - the message to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisejavascriptStackTrace - javascript stack trace coming from the the RN sidepublic void logError(java.lang.String message)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
message - the message to remotely logpublic void logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
message - the message to remotely logproperties - custom key-value pairs to include with the log messagepublic void logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
message - the message to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisepublic void logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
message - the message to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisejavascriptStackTrace - javascript stack trace coming from the the RN sidepublic void logError(java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot,
java.lang.String javascriptStackTrace,
boolean isException)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
message - the message to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisejavascriptStackTrace - javascript stack trace coming from the the RN sideisException - mark the log as an exceptionpublic void logError(java.lang.Throwable e)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
The stacktrace from the throwable will be used instead of the stack trace from where this method is called.
e - the throwable to remotely logpublic void logError(java.lang.Throwable e,
java.util.Map<java.lang.String,java.lang.Object> properties)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
The stacktrace from the throwable will be used instead of the stack trace from where this method is called.
e - the throwable to remotely logproperties - custom key-value pairs to include with the log messagepublic void logError(java.lang.Throwable e,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
The stacktrace from the throwable will be used instead of the stack trace from where this method is called.
e - the throwable to remotely logproperties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisepublic void logError(java.lang.Throwable e,
java.lang.String message,
java.util.Map<java.lang.String,java.lang.Object> properties,
boolean allowScreenshot)
If enabled for the current app, a screenshot will automatically be taken when the error is logged, and displayed on the dashboard with the error message.
The stacktrace from the throwable will be used instead of the stack trace from where this method is called.
e - the throwable to remotely logmessage - message to log (overrides getLocalizedMessage() from e)properties - custom key-value pairs to include with the log messageallowScreenshot - true if a screenshot should be taken for this message, false otherwisepublic void logBreadcrumb(java.lang.String message)
Breadcrumbs track a user's journey through the application and will be shown on the timeline.
message - the name of the breadcrumb to logpublic void logUnhandledJsException(java.lang.String name,
java.lang.String message,
java.lang.String type,
java.lang.String stacktrace)
name - name of the exception.message - exception message.type - error type.stacktrace - exception stacktrace.public void setReactNativeVersionNumber(java.lang.String version)
version - react native version number.public void setJavaScriptPatchNumber(java.lang.String number)
number - javascript patch number.public void setJavaScriptBundleURL(java.lang.String url)
url - path of the javascript bundle.public void setUnityMetaData(java.lang.String unityVersion,
java.lang.String buildGUID)
unityVersion - of the Unity SDKbuildGUID - if the Unity buildpublic void addConnectionQualityListener(ConnectionQualityListener listener)
ConnectionQualityListener, notifying the listener each time that there is
a change in the connection quality.listener - the listener to registerpublic void removeConnectionQualityListener(ConnectionQualityListener listener)
ConnectionQualityListener, suspending connection quality
notifications.listener - the listener to removepublic void endSession()
public void endSession(boolean clearUserInfo)
Cleans all the user info on the device.
public java.lang.String getDeviceId()
public void throwException()
public boolean startFragment(java.lang.String name)
A matching call to endFragment must be made.
name - the name of the fragment to logpublic boolean endFragment(java.lang.String name)
A matching call to startFragment must be made before this is called.
name - the name of the fragment to logpublic LocalConfig getLocalConfig()