Search…
SENTSDK
The SENTSDK class is the main entry point for interacting with the SDK.

sharedInstance

Method to call the shared instance of the SDK.
1
+ (instancetype) sharedInstance;
Copied!

initWithConfig: success: failure:

SDK initialization method. It sets up the modules internally and handles user authentication.
1
- (void) initWithConfig: (SENTConfig *) config
2
success: (void (^)(void)) success
3
failure: (void (^)(SENTInitIssue issue)) failure;
Copied!
Parameter
config
The configuration used to authenticate the user.
success
The success block called when init succeeded.
failure
The failure block called when init failed. It takes a SENTInitIssue issue indicating the reason of the failure.
Init should only be called once, unless initialization fails.

start:

Start the SDK.
1
- (void) start: (void (^)(SENTSDKStatus* status)) completion;
Copied!
Callback
completion
The completion block called when the SDK has started. SENTSDKStatus object indicates any issue that occurred when the SDK started.
start should be called only after the SDK has been successfully initialized.

startWithStopDate:

Start the SDK with expiration date.
1
- (void)startWithStopDate:(NSDate *)sdkStopDate
2
completion:(void (^)(SENTSDKStatus *status))completion;
Copied!
Parameter
sdkStopDate
Should be set with date in the future. Dates in past will cause imediate stop of SDK. Setting nil will start SDK as usual.
Callback
completion
The completion block called when the SDK has started. SENTSDKStatus object indicates any issue that occurred when the SDK started.

stop

Stop the SDK.
1
- (void) stop;
Copied!

getUserId

Returns the user ID
1
- (NSString *) getUserId;
Copied!

getUserAccessToken:

Returns the users Access Token if the user is authenticated
1
- (void) getUserAccessToken: (void (^)(NSString *token)) success
2
failure: (void (^)(void)) failure;
Copied!

addUserMetadataField: value:

Interface method to set metadata for user. Metadata is any additional data that enclosing app is willing to set for this user/app combination This metadata could contain vital information related to procesing wrt to the enclosing app.
1
- (void) addUserMetadataField: (NSString*) label
2
value: (NSString*) value;
Copied!
Parameter
label
Field name for the new entry.
value
Value for the new entry.

addUserMetadataFields:

Interface method to set metadata for user. Metadata is any additional data that enclosing app is willing to set for this user/app combination This metadata could contain vital information related to processing wrt to the enclosing app.
1
- (void) addUserMetadataFields: (NSDictionary *) metadata;
Copied!
Parameter
metadata
Key value pair data from enclosing app, could have any structure as long as it can be contained in a dictionary.

removeUserMetadataField:

Method to remove user data field to the sdk metadata (locally as well as on backend).
1
- (void) removeUserMetadataField:(NSString*)label;
Copied!
Parameter
label
Field name for the new entry.

addTripMetadata:

add metadata pertaining to the ongoing external trip. All added metadata will be aggregated and added to the trip payload. Returns NO if there's no ongoing external trip.
1
- (BOOL)addTripMetadata:(NSDictionary *)metadata;
Copied!
Parameter
metadata
key value pair data from enclosing app, could have any structure as long as it can be contained in a dictionary. The only time we return NO is when a trip is not ongoing, metadata contains NSNull objects or nil itself.

startTrip: transportModeHint: success: failure:

Start a Trip manually
1
- (void) startTrip: (NSDictionary*) metadata
2
transportModeHint: (SENTTransportMode) mode
3
success: (void (^)(void)) success
4
failure: (void (^)(SENTSDKStatus* status)) failure;
Copied!
Parameter
metadata
Key value pair data from enclosing app, could have any structure as long as it can be contained in a dictionary.
transportModeHint
Suggest of transport mode

stopTrip: failure:

Stop a trip.
1
- (void) stopTrip: (void (^)(void)) success
2
failure: (void (^)(SENTSDKStatus* status)) failure;
Copied!

setTripTimeOutListener:

Set a trip timeout block.
1
- (void) setTripTimeOutListener: (void (^)(void)) tripDidTimeOut;
Copied!
tripDidTimeOut block will be called each time trip will time out

isVehicleCrashDetectionSupported:

Checks if vehicle crash detection is supported on the device for the specified trip type.
The result depends on multiple criteria, such as if vehicle crash detection is enabled for your app, and if the necessary sensors are present on the device.
1
- (BOOL)isVehicleCrashDetectionSupported:(SENTTripType)tripType;
Copied!
Parameter
tripType
The type of trip for which you want to check

invokeDummyVehicleCrash

Invokes a dummy vehicle crash event. Use this method to test your vehicle crash detection integration.
Calling this method will invoke the handler from setVehicleCrashHandler:or setCrashListener:depending on which handler was set last.
1
- (void)invokeDummyVehicleCrash;
Copied!
This method is intended for testing your integration, and not for production use.

setCrashListener:

setCrashListener: is deprecated. Use setVehicleCrashHandler: instead.
Set vehicle crash detection block.
1
- (void)setCrashListener:(void (^)(NSDate *date, CLLocation *lastKnownLocation))crashCallback;
Copied!

setVehicleCrashHandler:

Sets a handler that is invoked when a vehicle crash is detected with an instance of SENTVehicleCrashEvent.
1
- (void)setVehicleCrashHandler:(void (^)(SENTVehicleCrashEvent *crashEvent))vehicleCrashHandler;
Copied!

setUserActivityListener:

This method provides the enclosing app the ability to get SDK detection updates. So when the SDK is in a trip or a stationary, it informs the app via a callback, providing some extra information.
1
- (void)setUserActivityListerner:(void (^)(SENTUserActivity *userActivity))onChange;
Copied!

getUserActivity

This method provides the enclosing app the ability to get SDK current user activity state. It is a trip or stationary with some enriched information.
1
- (SENTUserActivity *)getUserActivity;
Copied!

isTripOngoing:

Interface method to check if trip is in progress or not.
1
- (BOOL) isTripOngoing: (SENTTripType) tripType;
Copied!
Parameter
tripType
Type of ongoing trip, SDK - started by SDK, External - started by the application

submitDetections: failure:

Submits all the pending detections to backend, without considering any quota related updates and returns the status of these submissions via a callback to the enclosing app.
1
- (void) submitDetections: (void (^)(void)) success
2
failure: (void (^)(void)) failure;
Copied!
Parameter
success
Success block which is to be called when forced submission completes.
failure
Failure block which is to be called when forced submission completes.

isInitialised

This method is deprecated. Please use -(SENTSDKInitState)getInitState;
Return state of inialization of the SDK: SENTNotInitialized, SENTInitInProgress, SENTInitialized
1
- (BOOL) isInitialised;
Copied!

getInitState

Return state of inialization of the SDK: SENTNotInitialized, SENTInitInProgress, SENTInitialized
1
- (SENTSDKInitState) getInitState;
Copied!

getSdkStatus

Get SDK status information
1
- (SENTSDKStatus*) getSdkStatus;
Copied!

getVersion

Get SDK version
1
- (NSString *) getVersion;
Copied!

getWifiQuotaLimit

Get SDK WiFi quota limit
1
- (long) getWifiQuotaLimit;
Copied!

getWiFiQuotaUsage

Get SDK WiFi quota usage
1
- (long) getWiFiQuotaUsage;
Copied!

getMobileQuotaLimit

Get SDK mobile data quota limit
1
- (long) getMobileQuotaLimit;
Copied!

getMobileQuotaUsage

Get SDK mobile data quota usage
1
- (long) getMobileQuotaUsage;
Copied!

getDiskQuotaLimit

Get SDK disk quota limit
1
- (long) getDiskQuotaLimit;
Copied!

getDiskQuotaUsage

Get SDK disk quota usage
1
- (long) getDiskQuotaUsage;
Copied!

reset: failure:

The reset functionality is intended for removing all data in the device to handle a case such as a user logging out from an app or user requesting data deletion in the local app. It should not be used to reset the internal state of the SDK.
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 to InitState SENTResetting until it's complete. Calling any other SDK method during this time will either be ignored or return a default value.
Note that calling this method during intermediate initialization states (i.e. InitState SENTInitInProgress} and InitState SENTResetting will fail.
1
- (void)reset:(void(^)(void))success failure:(void(^)(SENTResetFailureReason reason))failure;
Copied!
Parameter
success
Success block callback when reset successfully done
failure
Failure callback when with one of SENTResetFailureReason happened

setTripProfileHandler:

Sets a block to execute after a trip finishes and is profiled on device. The profiling data is returned with a SENTTripProcessingTripProfile object.
Each SENTTripProcessingTripProfile contains multiple transport segments which each is assigned a SENTTripProcessingVehicleMode. The handler makes sure that only the transport segments that is assigned SENTTripProcessingVehicleModeVehicle are returned.
In order to use this handler, your app configuration must enable the trip profiling feature explicitly. Full trip profiling also needs to be disabled from the SDK. Please see [SENTSDK setFullTripProfilingEnabled:] for more details.
1
- (void)setTripProfileHandler:(void (^) (SENTTripProcessingTripProfile *tripProfile))tripProfileHandler;
Copied!
Parameter
tripProfileHandler
The block to execute after a trip finishes and is profiled on device.

setFullTripProfilingEnabled:

Changes the trip profiling mode the SDK is currently using.
Pass YES to let the trips being profiled on the Sentiance platform. If you previously set an on-device trip profiling handler via [SENTSDK setTripProfileHandler:], this also disables that handler. When NO is passed later, the handler continues to be called.
Pass NO to enable on-device trip profiling without uploading trip information to the Sentiance platform.
In order to use this method, your app configuration must enable the trip profiling feature explicitly.
1
- (void)setFullTripProfilingEnabled:(BOOL)enabled;
Copied!
Parameter
enabled
The flag that enables or disables trips being profiled on the Sentiance platform

setSpeedLimit:

Sets a custom speed limit in m/s that will be used during on-device speeding estimation. Any value that is less than or equal to "0" will be ignored.
If a custom speed limit is not set, the SDK uses a value of 23 m/s as the default speed limit.
In order to use this method, your app configuration must enable the trip profiling feature explicitly.
1
- (void)setSpeedLimit:(double)speedLimit;
Copied!
Parameter
speedLimit
The speed limit value that will be used during on-device speeding estimation
Last modified 11mo ago