Initialization
To initialize the GIZO SDK in your project, you need to add the following code snippets to the appDelegate file of your project:
#import <GizoSDK/GizoSDK-Swift.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"main";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
[self initializeGizoSDK:launchOptions];
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (void) initializeGizoSDK:(nullable NSDictionary *)launchOptions {
GizoOptions *options = [[GizoOptions alloc] init];
GizoInitializationResult *result = [[Gizo shared] initializeWithOptions:options launchOptions:launchOptions];
if (result.isSuccessful) {
NSLog(@"[SDK]: Initialization successful");
} else {
NSLog(@"[SDK]: Initialization failed, reason: %@", result.failure.debugDescription);
}
}
The table below describes the available options of GIZO SDK.
useGizoScoring
Boolean
true
true
if the recorded data are intended to be processed on the GIZO platform.
logToConsole
Boolean
true
Set to true
if you want to see the logs in the console.
logToFile
Boolean
true
Set to true
if you want to see the logs in the log file.
autoStart
Boolean
true
Set to true
to enable automatic trip recording when a new trip is detected.
autoStop
Boolean
true
Set to true
to stop recording trips automatically when the trip finishes.
Upload Settings
To prevent unexpected costs from excessive mobile data usage, the table below outlines the available configurations for the upload manager in the GIZO SDK:
isMobileDataEnabled
Boolean
true
Set to true
if you want to allow upload through mobile data.
isRomingDataEnabled
Boolean
false
Set to true
if you want to allow uploads while roaming on a cellular network.
mobileDataUsageLimit
Number
100.0
The trip data size threshold in MB, above which the data will not be uploaded, even if uploading through mobile data is enabled.
romingDataUsageLimit
Number
100.0
The trip data size threshold in MB, above which data will not be uploaded, even if mobile data uploading while roaming is enabled.
Crash Settings
To enable and configure the functionality of crash detection feature, the following parameters can be adjusted:
detectCrash
Boolean
false
Set to true
if you want to enable crash detection.
logToFile
Boolean
false
Set to true
if you want to see the crash-related logs in the crash log file.
mode
Enum
Prod
Set to Still_Test
when you what to test the functionality of crash detection. To perform a crash test at lower speeds (>=15kph), use Low_Speed_Test
. Otherwise, set to Prod
.
Initialization typically succeeds unless an unforeseen error or exception occurs. If it fails, you can review the returned result to identify the cause.
Last updated