LogoLogo
Insights
  • Introduction
  • A standard integration
  • FAQ
    • FAQ
      • Integration (FAQ)
      • Detections (FAQ)
      • Data interface (FAQ)
      • Security, Privacy and Terms of Service (FAQ)
      • Journeys and Insights (FAQ)
  • SDK
    • Getting Started
      • Android Quick Start
        • 1. Android Checklist
        • 2. Including the SDK
        • 3. Configuration
          • Sample Notification
        • 4. Initialization
        • 5. Starting Detections
        • 6. SDK Status Updates
        • 7. Permissions
        • 8. What's Next
      • iOS Quick Start
        • 1. iOS Checklist
        • 2. Installation
          • Installation with CocoaPods
          • Installation with Carthage
          • Manual Installation
        • 3. Configuration
          • Using Integration Guide
          • Manual Configuration
        • 4. Usage
        • 5. Tips and Guidelines
        • 6. What's Next
      • React Native Quick Start
        • 1. React Native Checklist
        • 2. Installation
        • 3. Configuration
        • 4. Initialization
        • 5. Usage
        • 6. What's Next
    • Appendix
      • Android
        • Android 10 Update Behavior
        • Android Battery Optimization
        • External SDK Dependencies
        • Manifest Permissions
        • Notification Management
      • iOS
        • App Store Privacy Section
        • App Store Release
        • iOS 13 permission changes
        • M1 Simulator Support
        • Swift Support
      • Control Sending Data
      • Controlled Detections
        • Automatic Detections
        • Automatic Detections with Forced Trips
        • Controlled Trips Only
        • Checking Trip Status
      • Custom User Metadata
      • Detecting Vehicle Crashes
      • Migration Guide
        • Android
        • iOS
      • React Native
      • SDK Initialization
      • User Credentials
      • User Linking
      • Xamarin
    • API Reference
      • Android
        • VehicleCrashDetection
          • VehicleCrashEvent
          • VehicleCrashListener
          • CrashCallback
        • InitState
        • MetaUserLinker
        • MetaUserLinkerAsync
        • MetaUserLinkerCallback
        • OnInitCallback
          • InitIssue
        • OnSdkStatusUpdateHandler
        • OnStartFinishedHandler
        • PoiAddress
        • PoiLocation
        • PointOfInterest
        • PoiPlace
        • ResetCallback
          • ResetFailureReason
        • SdkConfig
          • Builder
        • SdkException
        • SdkStatus
          • LocationSetting
          • Quota Status
          • StartStatus
        • Sentiance
        • SubmitDetectionsCallback
        • StationaryInfo
        • Token
        • TokenResultCallback
        • Trip
          • StartTripCallback
          • StopTripCallback
          • TransportMode
          • TripTimeoutListener
          • TripType
        • TripInfo
        • TripProfile
          • HardEvent
          • TransportSegment
          • VehicleMode
        • TripProfileConfig
          • Builder
        • TripProfileListener
        • UserActivity
        • UserActivityListener
        • UserActivityType
      • iOS
        • MetaUserLinker
        • SENTSDK
          • SENTSDKStatus
          • SENTPublicDefinitions
        • SENTConfig
        • SENTTripProcessingTripProfile
          • SENTTripProcessingTransportSegment
          • SENTTripProcessingHardEvent
          • SENTTripProcessingVehicleMode
        • SENTVehicleCrashEvent
      • React Native
    • Battery Optimization
    • How To
      • Check the Location Permissions
    • Troubleshooting
      • Android
      • iOS
        • Bundle format unrecognized, invalid, or unsuitable
        • Error: Undefined symbols for architecture arm64
    • Changelog
      • Android
      • iOS
  • Important topics
    • Authentication and Authorization
    • User linking
    • PlayStore Location Access Review
    • Privacy Report & Dashboard
    • Vehicle Crash Detection
  • Library
    • Events
    • Moments
    • Segments
    • Glossary
  • Backend
    • GraphQL
    • REST API Reference
      • Error Codes (REST API)
    • Offloads
    • Data Reference
      • Data Reference A-B
      • Data Reference C-G
      • Data Reference H-L
      • Data Reference M-P
      • Data Reference Q-T
      • Data Reference U-Z
  • Data Explorer
    • Data Explorer
      • Global (EU)
      • US
      • Australia
  • Guide
    • Firehose
    • Verifying your integration
    • SDK Standard License
    • Journeys License
    • Journeys Application
    • Journeys Privacy Policy
    • Technical & Organizational Measures
Powered by GitBook
On this page
  • Starting a Trip
  • Stopping a Trip
  1. SDK
  2. Appendix
  3. Controlled Detections

Automatic Detections with Forced Trips

PreviousAutomatic DetectionsNextControlled Trips Only

Last updated 1 year ago

This document refers to deprecated parts of the platform and has been left intact to help customers with legacy integrations. In order to access the latest platform features and documentation, please go to https://docs.sentiance.com.

While in , the SDK can be forced to start a trip. Doing so will prevent the SDK from detecting stationary moments and force it to continue collecting trip data until the trip is explicitly stopped.

Once the forced trip is stopped, the SDK will resume automatic detections.

Starting a Trip

You can start a trip as follows:

[[SENTSDK sharedInstance] startTrip:metadata 
                          transportModeHint:SENTTransportModeUnknown
    success:^{
    }
    failure:^(SENTSDKStatus *status) {
}];

The metadata is an NSDictionary representing a map of string to string types. You can use it to attach any piece of information to this trip. The transportModeHint is a hint you can give the SDK about the type of transport the trip is (e.g. car, bicycle, etc.).

In case starting a trip fails, you can check the SENTSDKStatus object to determine the reason.

startTrip(metadata, transportModeHint, new StartTripCallback() {
    @Override
    public void onSuccess () {
        // The trip was successfully started.
    }
    @Override
    public void onFailure (@Nullable SdkStatus sdkstatus) {
        // Something prevented the trip to start.
        // Check the status object for more details.
    }
});

The metadata is a map of string to string types. You can use it to attach any piece of information to this trip. The transportModeHint is a hint of type you can give the SDK about the type of transport the trip is (e.g. car, bicycle, etc.).

By passing a to the method, you will be notified when a trip is successfully started. If it fails, you can check the object to determine the reason.

Stopping a Trip

To stop a trip that you've started, call stopTrip as follows:

[[SENTSDK sharedInstance] stopTrip:^{
    // successfully stopped the trip
  } failure:^(SENTSDKStatus *status) {
    // stopping the trip failed
}];

If stopping the trip fails, you can check the SENTSDKStatus to determine why. Note that if no trip was ongoing, failure will be called as well.

To check if a trip is ongoing before calling stopTrip, see guide.

stopTrip(new StopTripCallback() {
    @Override
    public void onSuccess () {
    }
    @Override
    public void onFailure (@Nullable SdkStatus sdkstatus) {
    }
});

You can pass a to this method to be notified when the trip is stopped. If stopping the trip fails, you can check the to determine why. Note that if no trip was ongoing, the method will be called as well.

To check if a trip is ongoing before calling , see guide.

automatic detection mode
TransportMode
StartTripCallback
SdkStatus
this
StopTripCallback
SdkStatus
this
onFailure()
stopTrip()