pod install
Info.plist
NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
NSMotionUsageDescription
locationManager.requestWhenInUseAuthorization()
) and then ask the user to choose "Always Allow" option in the app settings and redirect user to the app settings page.DriveKitTripAnalysis
AppDelegate
class implement TripListener
protocol. This protocol contains 6 methods to implement:tripPoint(tripPoint: TripPoint)
: This method is called when a trip is started and confirmed, for each GPS point recorded by the SDK. Data available in TripPoint
object are described here.tripStarted(startMode: StartMode)
: This method is called each time a trip is started. StartMode
indicates which event starts the trip. Possible values are described here.tripCancelled(cancelTrip: CancelTrip)
: This method is called when a trip is cancelled. CancelTrip
indicates which event cancels the trip. Possible values are described here.tripFinished(post: PostGeneric, response: PostGenericResponse)
: This method is called when a trip has been recorded by the SDK and sent to DriveQuant's server to be analyzed. PostGeneric
object contains raw data sent to DriveQuant's server, PostGenericResponse
object contains the trip analysis made on DriveQuant's server. Detailed description of these data are available here.tripSavedForRepost()
: This method is called if at the end of the trip, the trip can be sent to DriveQuant's server for the analysis. The trip is saved locally on the SDK and will be sent later.beaconDetected()
: This method is called when a beacon sets in the SDK is detected.significantLocationChangeDetected()
: This method is called when a user significant location change is detected. sdkStateChanged(state: State)
: This method is called every time the state of the SDK changed with the new state as parameter. States are described here. didFinishLaunchingWithOptions
method of your AppDelegate file with launchOptions
as parameter.true
if it is well configured.carTypeIndex = 1
carEngineIndex = 1
carPower = 150
carMass = 1
carGearboxIndex = 2
carConsumption = 4.5
false
if the SDK is in inactive
state, and no trip is currently running.inactive
: No trip is running.starting
: The auto start mode detects a movement of the user and checks if it's a vehicled trip.running
: The trip has been confirmed by the speed of the movement.stopping
: The SDK is in this state when a potential trip end is detected. If the trip continues, the SDK goes back in running
state. The duration of the stopping state can be configured.sending
: The trip is finished and is being sent to DriveQuant's server. When the SDK has the response from the server, the state becomes inactive
waiting for the next trip.