init()
).init()
reset(ResetCallback)
getInitState()
getVersion()
addUserMetadataField()
1void addUserMetadataField(String label, String value)Copied!Adds a user specific metadata field.
addUserMetadataFields()
1void addUserMetadataFields(Map<String, String> metadata)Copied!Adds multiple user specific metadata fields.
addTripMetadata()
1boolean addTripMetadata(Map<String, String> metadata)Copied!Adds metadata while an external trip is ongoing. This method can be called multiple times during a trip.This method returns false if there is no ongoing external trip ornull
metadata is passed.
disableBatteryOptimization()
1void disableBatteryOptimization()Copied!Generates a system dialog asking the user to allow disabling battery optimization for the app.
getDiskQuotaLimit()
1long getDiskQuotaLimit()Copied!Returns the SDK's disk quota limit in bytes.
getDiskQuotaUsage()
1long getDiskQuotaUsage()Copied!Returns the SDK's disk quota usage in bytes.
getInitState()
1InitState getInitState()Copied!Returns the initialization state of the Sentiance SDK.
getInstance()
1static Sentiance getInstance(Context context)Copied!This method will callContext.getApplicationContext()
on the passed context to prevent memory leaks when passing an Activity context.
getMobileQuotaLimit()
1long getMobileQuotaLimit()Copied!Returns the SDK's mobile data quota limit in bytes.
getMobileQuotaUsage()
1long getMobileQuotaUsage()Copied!Returns the SDK's mobile data quota usage in bytes.
getSdkStatus()
1SdkStatus getSdkStatus()Copied!
getUserActivity()
1UserActivity getUserActivity()Copied!
getUserAccessToken()
1void getUserAccessToken(TokenResultCallback callback)Copied!
getUserId()
1@Nullable String getUserId()Copied!Returns the Sentiance user ID, ornull
if authentication has not yet succeeded.
getVersion()
1String getVersion()Copied!Returns the SDK version as a String.
getWiFiQuotaLimit()
1long getWiFiQuotaLimit()Copied!Returns the SDK's WiFi quota limit in bytes.
getWiFiQuotaUsage()
1long getWiFiQuotaUsage()Copied!Returns the SDK's WiFi quota usage in bytes.
init()
1void init(SdkConfig sdkConfig, final OnInitCallback initCallback)Copied!Initializes the Sentiance Sdk.This method constructs internal SDK components and prepares the SDK for handling app and system requests. If a Sentiance user does not yet exist on the device, this method triggers user creation on the Sentiance Platform, which requires internet connectivity.During the lifetime of the app process, calling this method again after a successful initialization is not allowed. Doing so is regarded as an error and therefore throws anSdkException
at runtime. To reinitialize the SDK with a different configuration or to create a new Sentiance user, first callreset(ResetCallback)
.All methods in this class (except this method,reset(ResetCallback)
,getInitState()
andgetVersion()
) will throw anSdkException
when called before initialization has completed.
invokeDummyCrash()
1void invokeDummyCrash()Copied!Invokes a dummy crash event. Use this method to test your crash callback integration.Calling this method will invoke theonCrash(long, Location)
method of yourCrashCallback
implementation, set viasetCrashCallback(CrashCallback)
.Note that this method is intended for testing your integration, and will only run on debug versions of your app (i.e. when theandroid:debuggable
manifest flag is set totrue
).
isCrashDetectionSupported()
1boolean isCrashDetectionSupported(TripType tripType)Copied!Checks if crash detection is supported on the device for the specified trip type.The result depends on multiple criteria, such as if crash detection is enabled for your app, and if the necessary sensors are present on the device.
isTripOngoing()
1boolean isTripOngoing(TripType tripType)Copied!Indicates whether a trip is in progress.
removeUserMetadataField()
1void removeUserMetadataField(String label)Copied!Removes a user specific metadata field.
reset()
1void reset(@Nullable ResetCallback callback)Copied!Resets the Sentiance SDK.Calling this method results in stopping of all SDK operations and deleting all SDK user data from the device. Additionally, the SDK will be uninitialized, allowing reinitialization and new Sentiance user creation.The reset operation may take a while, in which case the SDK's initialization state will be set toInitState.RESETTING
until it's complete. Calling any other SDK method during this time will either be ignored or return a default value. While resetting, make sure your app is in the foreground to prevent process termination (i.e. an activity is open, or a foreground service is running).Note that calling this method during intermediate initialization states (i.e.INIT_IN_PROGRESS
andRESETTING
) will fail.
setCrashCallback()
1void setCrashCallback(@Nullable CrashCallback callback)Copied!Sets a callback that is invoked when a vehicle crash is detected.
setTripProfileListener()
1void setTripProfileListener(@Nullable TripProfileListener tripProfileListener)Copied!Sets a listener that is invoked after a completed trip has been profiled. This feature must first be enabled for your app since it is not enabled by default.