Sternum Android SDK
|
a Singleton communication relay for Sternum ADS. Please use the static method getInstance
to get an SternumSDK instance.
Classes | |
enum | DeploymentPhase |
enum | DeviceType |
Public Member Functions | |
boolean | relayDeviceData (DeviceType deviceType, byte[] data) |
boolean | trace (TraceEventTypeInterface traceEventType, Argument... arguments) |
native boolean | flush () |
boolean | isInitialized () |
synchronized void | initialize (@NonNull Context context, @NonNull String sternumURL, @NonNull String firmwareVersion, boolean relayOverrideDeviceID, BigInteger sdkDeviceDefinitionID, DeploymentPhase deploymentPhase, long maxCacheSize, boolean loadNative) |
void | close () |
Static Public Member Functions | |
static synchronized SternumSDK | getInstance () |
Static Protected Member Functions | |
static byte[] | getSDKDeviceID (@NonNull Context context) |
static String | getCachePath (@NonNull Context context) |
void com.sternum.cloud.SternumSDK.close | ( | ) |
Closes the Sternum SDK. Call initialize to reinitialize.
native boolean com.sternum.cloud.SternumSDK.flush | ( | ) |
Flush transmission queue.
synchronized void com.sternum.cloud.SternumSDK.initialize | ( | @NonNull Context | context, |
@NonNull String | sternumURL, | ||
@NonNull String | firmwareVersion, | ||
boolean | relayOverrideDeviceID, | ||
BigInteger | sdkDeviceDefinitionID, | ||
DeploymentPhase | deploymentPhase, | ||
long | maxCacheSize, | ||
boolean | loadNative | ||
) |
Initializes the Singleton. Call this function when first created or if close was called.
context | application context |
sternumURL | your Sternum dedicated transmission URL. |
firmwareVersion | firmware version string for target application. |
relayOverrideDeviceID | if a remote device that originated the relayed traces cannot have a random a device ID, set to true and the application's device ID will be used. |
sdkDeviceDefinitionID | a device definition id for traces transmitted from the importing application. |
deploymentPhase | indicates if the application is in production/development phase. |
maxCacheSize | defines the maximum amount of bytes to store on disk when caching traces. Cache is automatically emptied when internet connection is available. |
loadNative | specify false if you wish to load on your own the native implementation of the SDK. |
boolean com.sternum.cloud.SternumSDK.isInitialized | ( | ) |
Checks if the singleton is initialized.
boolean com.sternum.cloud.SternumSDK.relayDeviceData | ( | DeviceType | deviceType, |
byte[] | data | ||
) |
Transmit relayed data that was received from a remote device.
deviceType | each device type as its own channel for relaying sternum traces. If you are relaying multiple devices in parallel, please make sure to assign each a different device type. |
data | data to relay. |
boolean com.sternum.cloud.SternumSDK.trace | ( | TraceEventTypeInterface | traceEventType, |
Argument... | arguments | ||
) |
Using this API, you will able to create traces.
Each trace call is constructed with a trace event type, defining the purpose of the trace. For example, TRACE_TASK_STARTED. Every trace event type has the "TRACE_" prefix.
A trace can posses multiple arguments. Each argument is constructed from an argument role type that defines the purpose of the argument. For example, ARG_ROLE_NAME. Every argument role type has the "ARG_ROLE_" prefix.
Traces and arguments roles are defined in the TraceEventType.java and ArgumentRoleType.java files. You can download them at any time from ADS.
The Argument class supports an integer/float/string/blob type arguments.
Please see example below: sternumSDK.trace(TraceEventType.TRACE_OS_INFORMATION, new Argument(ArgumentRoleType.ARG_ROLE_NAME, "Android"), new Argument(ArgumentRoleType.ARG_ROLE_VERSION, Build.VERSION.SDK_INT));
traceEventType | the trace event type |
arguments | the trace's arguments. |