ZendriveDelegateProtocol

@protocol ZendriveDelegateProtocol <NSObject>

Delegate for Zendrive.

  • Called on delegate in the main thread when Zendrive SDK detects a potential start of a drive.

    Declaration

    Objective-C

    - (void)processStartOfDrive:(nonnull ZendriveDriveStartInfo *)startInfo;

    Parameters

    startInfo

    Info about drive start. Refer to ZendriveDriveStartInfo for further details.

  • Called on delegate in the main thread when Zendrive SDK resumes a drive after a gap.

    The gap in drive recording may occur due to an application restart by the OS, application kill and restart by a user, an application crash or other reasons. Drives started by calling +[Zendrive startManualDrive:completionHandler:] are always resumed and they will not end until +[Zendrive stopManualDrive:completionHandler:] is called.

    Declaration

    Objective-C

    - (void)processResumeOfDrive:(nonnull ZendriveDriveResumeInfo *)resumeInfo;

    Parameters

    resumeInfo

    Info about drive resume. Refer to ZendriveDriveResumeInfo for further details.

  • Called on the delegate in the main thread when Zendrive SDK detects a drive to have been completed.

    It is possible that Zendrive SDK might decide at a later time that an ongoing trip was a falsely detected trip. In such scenario processEndOfDrive: will be invoked on delegate with ZendriveDriveInfo.driveType set to ZendriveDriveTypeInvalid.

    Every trip with ZendriveDriveInfo.driveType not set to ZendriveDriveTypeInvalid will receive a corresponding -processAnalysisOfDrive: callback containing additional info related to this drive.

    Declaration

    Objective-C

    - (void)processEndOfDrive:
        (nonnull ZendriveEstimatedDriveInfo *)estimatedDriveInfo;

    Parameters

    estimatedDriveInfo

    Best estimate info about the drive. Refer to ZendriveEstimatedDriveInfo for further details.

  • Called on the delegate in the main thread when Zendrive SDK finishes full analysis of all valid drives returned from -processEndOfDrive: callback.

    This will be called for all the -processEndOfDrive: callbacks with the value of ZendriveDriveInfo.driveType not set to ZendriveDriveTypeInvalid.

    This may contain additional or improved data over the ZendriveEstimatedDriveInfo returned from -processEndOfDrive:

    Typically this callback will be fired within a few seconds after -processEndOfDrive: callback but in some rare cases this delay can be really large depending on phone network conditions.

    This callback will be fired in trip occurrence sequence, i.e from oldest trip to the latest trip.

    Declaration

    Objective-C

    - (void)processAnalysisOfDrive:
        (nonnull ZendriveAnalyzedDriveInfo *)analyzedDriveInfo;

    Parameters

    analyzedDriveInfo

    Analyzed insights of the drive.

  • [Disabled by default] This callback is fired on the main thread when a potential accident is detected by the SDK during a drive. This is a preliminary callback of a potential collision. This collision is confirmed or invalidated by -processAccidentDetected: callback.

    To enable contact: support@zendrive.com

    Declaration

    Objective-C

    - (void)processPotentialAccidentDetected:
        (nonnull ZendriveAccidentInfo *)accidentInfo;

    Parameters

    accidentInfo

    Info about accident.

  • This callback is fired on the main thread when an accident is detected by the SDK during a drive. Any ongoing auto-detected/manual drives will be stopped after this point.

    Declaration

    Objective-C

    - (void)processAccidentDetected:(nonnull ZendriveAccidentInfo *)accidentInfo;

    Parameters

    accidentInfo

    Info about accident.

  • Deprecated

    Use -settingsChanged: callback instead.

    This callback is fired on main thread when location services are denied for the SDK. After this callback, drive detection is paused until location services are re-enabled for the SDK.

    The expected behaviour is that the enclosing application shows an appropriate popup prompting the user to allow location services for the app.

    The callback is triggered once every time location services are denied by the user and can be triggered in background or in foreground, depending on whether the SDK has enough CPU time to execute.

    This callback is not sent if ZendriveConfiguration.managesLocationPermission value was set to NO at setup.

    Declaration

    Objective-C

    - (void)processLocationDenied;
  • Deprecated

    Use -settingsChanged: callback instead.

    This method is called when location permission state is determined for the first time or whenever it changes.

    This callback is not sent if ZendriveConfiguration.managesLocationPermission value was set to NO at setup.

    Declaration

    Objective-C

    - (void)processLocationApproved;
  • Deprecated

    Use settingsChanged: callback instead.

    This callback is fired if activity and fitness permission is denied for the SDK.

    This callback is not sent if ZendriveConfiguration.managesActivityPermission value was set to NO at setup

    Declaration

    Objective-C

    - (void)processActivityDenied;
  • Deprecated

    Use -settingsChanged: callback instead.

    This callback is fired if activity and fitness permission is approved for the SDK.

    This callback is not sent if ZendriveConfiguration.managesActivityPermission value was set to NO at setup

    Declaration

    Objective-C

    - (void)processActivityApproved;
  • This callback gives information about errors in device or application settings that may be affecting Zendrive SDK.

    This callback is fired on the main thread after SDK setup and whenever location permission or ZendriveConfiguration.driveDetectionMode changes, provided the location permission is determined.

    The recommended flow is to ask for the permissions before SDK is setup because if the location permission is not determined this callback will not be fired.

    If you receive this callback in the foreground you can show the errors using any UI constructs like alert controllers, if this callback is received in the background you can use a notification. If you want to add actions to the notification then please don’t rely on errors received at the time of notification as they might have changed by the time the user clicks on the notification. Instead use +[Zendrive getZendriveSettings] to get the latest errors and show appropriate message to the user.

    Declaration

    Objective-C

    - (void)settingsChanged:(ZendriveSettings *_Nonnull)settings;

    Parameters

    settings

    A valid ZendriveSettings object that contains information about errors affecting the Zendrive SDK.

  • This callback is fired when the SDK detects a change in the business hours set by the fleet manager and the current business hours applied on the SDK. NOTE: to fetch the business hours instantly use Zendrive:refreshBusinessHours:completionHandler

    Declaration

    Objective-C

    - (void)businessHoursChanged:(ZendriveShiftDetail *_Nonnull)businessHours;

    Parameters

    businessHours

    A valid ZendriveShiftDetail object that contains the new business hours.