public final class Mint
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
appEnvironmentDevelopment |
static java.lang.String |
appEnvironmentRelease |
static java.lang.String |
appEnvironmentStaging |
static java.lang.String |
appEnvironmentTesting |
static java.lang.String |
appEnvironmentUserAcceptanceTesting |
static java.lang.String |
XSplunkMintSessionIdHeader
The header name to use for HTTP.
|
static java.lang.String |
XSplunkMintUuidHeader
The header name to use for HTTP.
|
Constructor and Description |
---|
Mint() |
Modifier and Type | Method and Description |
---|---|
static void |
addExtraData(java.lang.String key,
java.lang.String value)
Adds a key-value pair to the extra data.
|
static void |
addURLToBlackList(java.lang.String url)
Adds a URL to the network monitoring blacklist.
|
static void |
clearExtraData()
Clears all extra data.
|
static void |
clearTotalCrashesNum()
Clears the total number of crashes.
|
static void |
closeSession(android.app.Application app)
Closes the active session.
|
static void |
disableAutoFlash()
disable auto flush, should be called before SDK initialization.
|
static void |
disableCrashMonitoring()
Disables crash monitoring.
|
static void |
disableMemoryPressureMonitoring()
Disables Memory Pressure monitoring.
|
static void |
disableNetworkMonitoring()
Disables network monitoring.
|
static void |
enableDebugLog()
Enables the display of debug messages.
**Note** You should turn this feature off in production. |
static void |
enableLogging(boolean enable)
Enables LogCat logging.
|
static void |
flush()
Flushes all saved data.
|
static org.json.JSONObject |
getDevSettings()
Gets the developer settings from the remote settings.
|
static java.util.HashMap<java.lang.String,java.lang.Object> |
getExtraData()
Gets the extra data map.
|
static java.lang.String |
getLastCrashID()
Gets the error hash of the last crash.
|
static java.lang.String |
getMintUUID()
Returns the MINT universally unique identifier (UUID), which uniquely
identifies a specific user.
|
static java.lang.String |
getSessionId()
Returns the current session ID.
|
static int |
getTotalCrashesNum()
Returns the total number of crashes.
|
static void |
initAndStartSession(android.app.Application app,
java.lang.String apiKey)
Use this constructor to initialize and start the session for the MINT
Data Collector environment.
|
static void |
initAndStartSessionHEC(android.app.Application app,
java.lang.String url,
java.lang.String token)
Use this constructor to initialize and start the session for the HTTP
Event Collector (HEC) environment.
|
static void |
leaveBreadcrumb(java.lang.String breadcrumb)
Leaves a breadcrumb at a point of interest in your code.
|
static void |
logEvent(java.lang.String eventName)
Logs an event and uses the default log level `Verbose`.
|
static void |
logEvent(java.lang.String eventName,
MintLogLevel logLevel)
Logs an event with a specific log level.
|
static void |
logEvent(java.lang.String eventName,
MintLogLevel logLevel,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Logs an event with a specific log level.
|
static void |
logEvent(java.lang.String eventName,
MintLogLevel logLevel,
java.lang.String keyName,
java.lang.String keyValue)
Logs an event with a specific log level.
|
static void |
logException(java.lang.Exception ex)
Submits a handled exception (if inside a `try-catch` block) and a map of
custom data.
|
static void |
logException(java.util.HashMap<java.lang.String,java.lang.Object> customData,
java.lang.Exception exception)
Submits a handled exception (if inside a `try-catch` block) and a map of
custom data.
|
static void |
logException(java.lang.String key,
java.lang.String value,
java.lang.Exception exception)
Submits a handled exception (if inside a `try-catch` block) and a custom
key-value pair.
|
static void |
logNetworkEvent(java.lang.String url,
java.lang.String protocol,
long startTime,
long endTime,
int httpStatusCode,
long requestLength,
long responseLength,
java.lang.String serverException,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Logs a network event as Splunk data type.
|
static void |
logView(java.lang.String view)
Logs a specific view as a Splunk data type.
|
static void |
logView(java.lang.String view,
java.util.HashMap<java.lang.String,java.lang.Object> extraData)
Logs a specific view as a Splunk data type.
|
static void |
logView(java.lang.String view,
java.lang.String key,
java.lang.String value)
Logs a specific view as a Splunk data type.
|
static void |
removeExtraData(java.lang.String key)
Removes a specific key-value pair from the extra data.
|
static void |
setApplicationEnvironment(java.lang.String environment)
Sets the application environment.
|
static void |
setAutoFlushMinimumInterval(int interval)
Set the minimum interval of auto flush.
|
static void |
setFlushOnlyOverWiFi(boolean enabled)
Enables MINT to flush data only when there is a WiFi connection.
**Note** Be sure to add the ACCESS_NETWORK_STATE permission to your AndroidManifest.xml file. |
static void |
setLocation(android.location.Location location)
Sets the location
|
static void |
setLogging(int lines)
Restricts the number of lines in the LogCat output.
|
static void |
setLogging(int lines,
java.lang.String filter)
Restricts the number of lines in the LogCat output and sets a LogCat
filter string.
|
static void |
setLogging(java.lang.String filter)
Sets a LogCat filter string.
|
static void |
setMintCallback(MintCallback mintCallback)
Sets a Mint callback interface, which is used for the **lastBreath**
callback, the **netSaverResponse** callback, and the
**dataSaverResponse** callback.
|
static void |
setSessionInterval(int timeInSecs)
Sets the session interval time.
|
static void |
setUserIdentifier(java.lang.String userIdentifier)
Sets an identifier for the current user.
|
static void |
setUserOptOut(boolean optedOut)
Indicates whether to prevent MINT from saving or sending any data for the
user.
|
static void |
startANRMonitoring(int timeout,
boolean ignoreDebugger)
Starts Application Not Responding (ANR) monitoring.
|
static void |
startSession(android.app.Application app)
Starts a new session.
|
static java.lang.String |
timerStart(java.lang.String name)
Starts a timer.
|
static void |
timerStop(java.lang.String id)
Stops a timer.
|
static void |
transactionCancel(java.lang.String id,
java.lang.String reason)
Cancels a transaction.
|
static void |
transactionCancel(java.lang.String id,
java.lang.String reason,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Cancels a transaction.
|
static void |
transactionCancel(java.lang.String id,
java.lang.String reason,
java.lang.String keyName,
java.lang.String keyValue)
Cancels a transaction.
|
static java.lang.String |
transactionStart(java.lang.String name)
Starts a transaction.
|
static java.lang.String |
transactionStart(java.lang.String name,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Starts a transaction.
|
static java.lang.String |
transactionStart(java.lang.String name,
java.lang.String keyName,
java.lang.String keyValue)
Starts a transaction.
|
static void |
transactionStop(java.lang.String id)
Stops a transaction.
|
static void |
transactionStop(java.lang.String id,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Stops a transaction.
|
static void |
transactionStop(java.lang.String id,
java.lang.String keyName,
java.lang.String keyValue)
Stops a transaction.
|
static void |
xamarinException(java.lang.Exception exception,
boolean handled,
java.util.HashMap<java.lang.String,java.lang.Object> customData)
Submits a exception from Xamarin.
|
public static final java.lang.String appEnvironmentRelease
public static final java.lang.String appEnvironmentStaging
public static final java.lang.String appEnvironmentUserAcceptanceTesting
public static final java.lang.String appEnvironmentTesting
public static final java.lang.String appEnvironmentDevelopment
public static final java.lang.String XSplunkMintSessionIdHeader
public static final java.lang.String XSplunkMintUuidHeader
public static void initAndStartSession(android.app.Application app, java.lang.String apiKey)
app
- The Application instance.apiKey
- The API key you received for the project.public static void initAndStartSessionHEC(android.app.Application app, java.lang.String url, java.lang.String token)
app
- The Application instance.url
- The URL of the HEC MINT endpoint.token
- The token of the HEC input.public static void startSession(android.app.Application app)
app
- The Application instance.public static void closeSession(android.app.Application app)
app
- The Application instance.public static void flush()
public static final void startANRMonitoring(int timeout, boolean ignoreDebugger)
timeout
- The timeout, in milliseconds. A suggested value is 5000.ignoreDebugger
- `true` to ignore ANRs when the debugger is attached. The suggested value is `true`.public static void setSessionInterval(int timeInSecs)
timeInSecs
- The session interval time, in seconds.public static void setUserOptOut(boolean optedOut)
optedOut
- `true` to enable user opt-out, `false` to disable it.public static void disableNetworkMonitoring()
public static void disableCrashMonitoring()
public static final void setMintCallback(MintCallback mintCallback)
mintCallback
- The Mint callback interface.public static void leaveBreadcrumb(java.lang.String breadcrumb)
breadcrumb
- The name of the breadcrumb.public static void logView(java.lang.String view)
view
- The name of the view.public static void logView(java.lang.String view, java.lang.String key, java.lang.String value)
view
- The name of the view.key
- Extra data key.value
- Extra data value.public static void logView(java.lang.String view, java.util.HashMap<java.lang.String,java.lang.Object> extraData)
extraData
- Extra data.view
- The name of the view.public static void logEvent(java.lang.String eventName)
eventName
- The name of the event.public static void logEvent(java.lang.String eventName, MintLogLevel logLevel)
eventName
- The name of the event.logLevel
- The log level of the event.public static void logEvent(java.lang.String eventName, MintLogLevel logLevel, java.util.HashMap<java.lang.String,java.lang.Object> customData)
eventName
- The name of the event.logLevel
- The log level of the event.customData
- The HashMap containing custom data.public static void logEvent(java.lang.String eventName, MintLogLevel logLevel, java.lang.String keyName, java.lang.String keyValue)
eventName
- The name of the event.logLevel
- The log level of the event.keyName
- The key name for extra data.keyValue
- The value of extra data.public static void setUserIdentifier(java.lang.String userIdentifier)
userIdentifier
- The user identifier, such as a random ID, an email address, or
a user name.public static void setApplicationEnvironment(java.lang.String environment)
environment
- The application environment.public static void enableDebugLog()
public static void setFlushOnlyOverWiFi(boolean enabled)
enabled
- `true` to enable sending date over WiFi only, `false` to
disable it.public static void setAutoFlushMinimumInterval(int interval)
interval
- the minimum interval of auto flush, in milliseconds.public static void disableAutoFlash()
public static java.lang.String transactionStart(java.lang.String name)
name
- The name of the transaction.public static java.lang.String transactionStart(java.lang.String name, java.util.HashMap<java.lang.String,java.lang.Object> customData)
name
- The name of the transaction.customData
- The HashMap containing custom data.public static java.lang.String transactionStart(java.lang.String name, java.lang.String keyName, java.lang.String keyValue)
name
- The name of the transaction.keyName
- The key name for extra data.keyValue
- The value of extra data.public static void transactionStop(java.lang.String id)
id
- The ID of the transaction.public static void transactionStop(java.lang.String id, java.util.HashMap<java.lang.String,java.lang.Object> customData)
id
- The ID of the transaction.customData
- The HashMap containing custom data.public static void transactionStop(java.lang.String id, java.lang.String keyName, java.lang.String keyValue)
id
- The ID of the transaction.keyName
- The key name for extra data.keyValue
- The value of extra data.public static void transactionCancel(java.lang.String id, java.lang.String reason)
id
- The ID of the transaction.reason
- The reason for canceling the transaction. This value can be
`null` or empty.public static void transactionCancel(java.lang.String id, java.lang.String reason, java.util.HashMap<java.lang.String,java.lang.Object> customData)
id
- The ID of the transaction.reason
- The reason for canceling the transaction. This value can be
`null` or empty.customData
- The HashMap containing custom data.public static void transactionCancel(java.lang.String id, java.lang.String reason, java.lang.String keyName, java.lang.String keyValue)
id
- The ID of the transaction.reason
- The reason for canceling the transaction. This value can be
`null` or empty.keyName
- The key name for extra data.keyValue
- The value of extra data.public static java.lang.String timerStart(java.lang.String name)
name
- The name of the timer.public static void timerStop(java.lang.String id)
id
- The timer ID.public static java.util.HashMap<java.lang.String,java.lang.Object> getExtraData()
public static void addExtraData(java.lang.String key, java.lang.String value)
key
- The key.value
- The value.public static void removeExtraData(java.lang.String key)
key
- The key to remove.public static void clearExtraData()
public static int getTotalCrashesNum()
public static void clearTotalCrashesNum()
public static java.lang.String getLastCrashID()
public static void logException(java.util.HashMap<java.lang.String,java.lang.Object> customData, java.lang.Exception exception)
customData
- The HashMap containing custom data.exception
- The handled exception.public static void logException(java.lang.Exception ex)
ex
- The handled exception.public static void logException(java.lang.String key, java.lang.String value, java.lang.Exception exception)
key
- The key.value
- The value.exception
- The handled exception.public static void xamarinException(java.lang.Exception exception, boolean handled, java.util.HashMap<java.lang.String,java.lang.Object> customData)
exception
- The exception.handled
- Handled flag. true - handled, false - unhandled.customData
- Optional custom data. Please pass null if you don't have custom data.public static void enableLogging(boolean enable)
enable
- `true` to enable LogCat logging, `false` to disable it.public static void setLogging(int lines)
lines
- The number of lines to report.public static void setLogging(java.lang.String filter)
filter
- The filter expression. For more information, see [ Filtering
Log
Output](http://developer.android.com/tools/debugging/debugging
-log.html#filteringOutput) on the Android Developers website.public static void setLogging(int lines, java.lang.String filter)
lines
- The number of lines to report.filter
- The filter expression. For more information, see [ Filtering
Log
Output](http://developer.android.com/tools/debugging/debugging
-log.html#filteringOutput) on the Android Developers website.public static org.json.JSONObject getDevSettings()
public static void addURLToBlackList(java.lang.String url)
url
- The URL to ignore.public static void disableMemoryPressureMonitoring()
public static final java.lang.String getSessionId()
public static final java.lang.String getMintUUID()
public static void setLocation(android.location.Location location)
location
- Location instance.public static void logNetworkEvent(java.lang.String url, java.lang.String protocol, long startTime, long endTime, int httpStatusCode, long requestLength, long responseLength, java.lang.String serverException, java.util.HashMap<java.lang.String,java.lang.Object> customData)
url
- The URL of the network request.protocol
- The network protocol of the request. Usually HTTP/S.startTime
- The start timestamp of the request in milliseconds. Usually obtained by calling System.currentTimeMillis()
before starting the network request.endTime
- The end timestamp of the request in milliseconds. Usually obtained by calling System.currentTimeMillis()
after the request ends.httpStatusCode
- The HTTP status code as received from the network library. If your request failed before establishing an HTTP connection,
this value should be zero.requestLength
- The request length in bytes.responseLength
- The response length in bytes. If your request failed before receiving a server response, this value should
be zero.serverException
- Sometimes when the server returns an HTTP error code, the HTTP response will contain more details about the server side error.
serverException can be called to pass this error to a Splunk data type. If your request failed before receiving a server
response, this value should be null.customData
- The HashMap containing custom data.