<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Damoov</title>
    <description>The latest articles on DEV Community by Damoov (@damoov).</description>
    <link>https://dev.to/damoov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4027412%2F39e4d01c-1bca-43b8-81b9-c2961b44f299.png</url>
      <title>DEV Community: Damoov</title>
      <link>https://dev.to/damoov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/damoov"/>
    <language>en</language>
    <item>
      <title>Crash Detection Algorithms on Smartphones: How to Minimize False Positives in Telematics Apps</title>
      <dc:creator>Damoov</dc:creator>
      <pubDate>Mon, 03 Aug 2026 15:47:24 +0000</pubDate>
      <link>https://dev.to/damoov/crash-detection-algorithms-on-smartphones-how-to-minimize-false-positives-in-telematics-apps-4ilh</link>
      <guid>https://dev.to/damoov/crash-detection-algorithms-on-smartphones-how-to-minimize-false-positives-in-telematics-apps-4ilh</guid>
      <description>&lt;p&gt;Detecting a high-G impact on a smartphone accelerometer is straightforward. Knowing whether that impact was a vehicle collision — and acting on it without flooding your claims desk with pothole alerts — is where &lt;strong&gt;crash detection algorithms&lt;/strong&gt; earn or lose integrator trust.&lt;/p&gt;

&lt;p&gt;This article is the canonical false-positive reference for Damoov's developer content series. It covers validation pipeline architecture, severity-banded classification, threshold tuning for different deployments, and how to handle accident events in production code. For the full crash-detection pipeline (sensor fusion, high-frequency capture, FNOL), see &lt;a href="https://damoov.com/how-automatic-crash-detection-works/" rel="noopener noreferrer"&gt;How Automatic Crash Detection Works&lt;/a&gt;. For the business and use-case angle, start with &lt;a href="https://damoov.com/crash-detection-mobile-telematics/" rel="noopener noreferrer"&gt;Crash Detection with Mobile Telematics&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why false positives dominate the engineering problem
&lt;/h2&gt;

&lt;p&gt;A phone in a moving vehicle experiences dozens of high-G events per day that have nothing to do with collisions: drops onto a seat, door slams, speed bumps, hard braking, railway crossings. A naive threshold — "trigger if acceleration exceeds X g" — produces alert volumes that make the feature unusable.&lt;/p&gt;

&lt;p&gt;The cost of getting this wrong is asymmetric:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Insurance FNOL.&lt;/strong&gt; Every false alert creates a claims touchpoint, adjuster time, and policyholder anxiety. Alert fatigue erodes trust in the entire telematics program.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fleet safety.&lt;/strong&gt; Managers stop responding when 80% of "crashes" are curb bumps on urban routes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emergency services.&lt;/strong&gt; False positives in SOS workflows have regulatory and liability implications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;crash detection algorithm&lt;/strong&gt; that ships in production is therefore a &lt;em&gt;filtering&lt;/em&gt; problem layered on top of a &lt;em&gt;detection&lt;/em&gt; problem. Detection finds candidate impacts; validation decides which candidates become confirmed accidents.&lt;/p&gt;

&lt;h2&gt;
  
  
  False positive taxonomy: what triggers look like
&lt;/h2&gt;

&lt;p&gt;False positives fall into predictable categories. Understanding the taxonomy helps you tune thresholds and explain alert volumes to stakeholders — without treating every pothole as a unique mystery.&lt;/p&gt;

&lt;h3&gt;
  
  
  Device-handling events (no vehicle context)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Phone drop&lt;/strong&gt; — extreme peak G (50–200 g), near-instant duration, single-axis dominant, no preceding vehicle speed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phone toss onto seat&lt;/strong&gt; — sharp deceleration spike, rotation pattern inconsistent with vehicle impact, no GPS velocity context.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Road-surface events (vehicle moving, sub-collision forces)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Potholes and speed bumps&lt;/strong&gt; — vertical-axis dominant spike (3–8 g), vehicle continues at speed, no sustained multi-axis deceleration signature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Railway crossings and expansion joints&lt;/strong&gt; — rhythmic vertical impulses; duration and frequency distinguish from deformation events.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Driving dynamics (real vehicle, below crash threshold)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hard braking without collision&lt;/strong&gt; — sustained longitudinal deceleration (3–6 g) but vehicle continues moving; below crash confirmation gates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aggressive cornering&lt;/strong&gt; — lateral G elevated but no impact discontinuity; gyroscope shows controlled rotation not impact spin.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Post 15100 summarizes these categories in its detection pipeline overview. This article goes deeper on &lt;em&gt;how the algorithm rejects them&lt;/em&gt; — the gates, bands, and tuning levers — not the source list itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Multi-signal validation pipeline
&lt;/h2&gt;

&lt;p&gt;Reliable crash detection algorithms require &lt;strong&gt;convergence&lt;/strong&gt; across independent signals before confirming an accident. No single gate is sufficient; the pipeline stacks them in sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Velocity gate&lt;/strong&gt; — device was traveling at vehicle speed (typically &amp;gt;15 km/h) in the seconds before the event. Filters stationary phone drops and parking-lot handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duration gate&lt;/strong&gt; — high-G persists long enough to reflect vehicle deformation, not a point impulse. A dropped phone peaks and returns in milliseconds; collision energy dissipates over hundreds of milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-axis gate&lt;/strong&gt; — real crashes produce significant force on at least two axes (longitudinal + lateral or vertical). Single-axis dominance flags handling events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Post-event behavior gate&lt;/strong&gt; — after a confirmed crash, the vehicle typically stops or moves erratically. Continuing at highway speed after a 40 g spike is a rejection signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rotation correlation gate&lt;/strong&gt; — gyroscope dynamics must be consistent with vehicle impact, not device rotation in a cup holder.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each gate is a configurable threshold, not a hardcoded constant. That is what makes the same architecture work for teen-driver monitoring (more sensitive) and long-haul fleet on rough roads (more tolerant).&lt;/p&gt;

&lt;h2&gt;
  
  
  Severity-banded classification
&lt;/h2&gt;

&lt;p&gt;After validation, confirmed events are classified into severity bands that drive downstream behavior. Treating every confirmed impact as a maximum-severity FNOL is how integrators burn out their operations team.&lt;/p&gt;

&lt;p&gt;A practical three-band model:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Band&lt;/th&gt;
&lt;th&gt;Typical signature&lt;/th&gt;
&lt;th&gt;Recommended action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Low&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Passes minimum gates; peak G and duration below high-severity thresholds; reliability score moderate&lt;/td&gt;
&lt;td&gt;Log event, include in trip timeline, no automated FNOL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Medium&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Strong multi-axis signature; reliability above review threshold; speed context consistent with minor collision&lt;/td&gt;
&lt;td&gt;In-app driver prompt ("Were you in an accident?"); queue for manual review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;High&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High peak G, sustained duration, post-event stop, high reliability score&lt;/td&gt;
&lt;td&gt;Trigger FNOL workflow, emergency contact, high-frequency buffer upload&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Damoov platform exposes a &lt;strong&gt;Reliability&lt;/strong&gt; score on accident events (see &lt;a href="https://docs.damoov.com/docs/crash-data" rel="noopener noreferrer"&gt;Crash Data&lt;/a&gt;) — a numeric confidence measure integrators can map directly to these bands. An event with low reliability should not trigger the same workflow as one scoring high confidence, regardless of peak G alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Threshold tuning by deployment
&lt;/h2&gt;

&lt;p&gt;There is no universal threshold set. The same algorithm architecture supports different sensitivity profiles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sensitive (UBI, teen monitoring)&lt;/strong&gt; — lower velocity gate, shorter duration minimum, more medium-band events. Accepts higher false-positive rate in exchange for catching low-speed parking-lot impacts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standard (general insurance)&lt;/strong&gt; — balanced defaults. Suitable for mixed urban/suburban driving.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tough (fleet, rough-road routes)&lt;/strong&gt; — higher G thresholds, stricter multi-axis requirements, longer duration gate. Reduces pothole and speed-bump triggers on degraded surfaces.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tuning is not a one-time launch task. Monitor false-positive rate per 1,000 trips by road-type segment and adjust quarterly. A fleet operating exclusively in urban cores needs different parameters than long-haul highway logistics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling accident events in code
&lt;/h2&gt;

&lt;p&gt;When the SDK detects a candidate accident, it surfaces through the event callback. Your app should filter by event type and apply reliability-based routing — not treat every callback as a confirmed crash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Android / Kotlin — filter and route by reliability:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onNewEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"Accident"&lt;/span&gt; &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;accident&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;
        &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;accident&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reliability&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nc"&gt;HIGH_RELIABILITY_THRESHOLD&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// High band: trigger FNOL / emergency workflow&lt;/span&gt;
                &lt;span class="nf"&gt;triggerFnolWorkflow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;accident&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="n"&gt;accident&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reliability&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nc"&gt;REVIEW_THRESHOLD&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// Medium band: prompt driver or queue for review&lt;/span&gt;
                &lt;span class="nf"&gt;showAccidentConfirmationDialog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;accident&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="c1"&gt;// Low band: log only, no automated claims action&lt;/span&gt;
                &lt;span class="nf"&gt;logSubThresholdAccident&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;accident&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The accident payload includes peak accelerations, speed at impact, duration, GPS coordinates, and the reliability score. Full field reference: &lt;a href="https://docs.damoov.com/docs/crash-data" rel="noopener noreferrer"&gt;Crash Data documentation&lt;/a&gt;. High-frequency sensor buffers (60 Hz iOS / 100 Hz Android, 5 seconds before and after) upload separately for forensic review on high-band events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring alert fatigue in production
&lt;/h2&gt;

&lt;p&gt;Integrators should track these metrics from launch, not after the claims desk complains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Confirmed accidents per 1,000 trips&lt;/strong&gt; — baseline varies by market; sudden spikes often indicate threshold misconfiguration, not more crashes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FNOL auto-triggers overturned by driver denial&lt;/strong&gt; — high denial rate = sensitivity too aggressive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Medium-band events with no user response&lt;/strong&gt; — may indicate prompt fatigue; consider raising review threshold.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability score distribution&lt;/strong&gt; — if 90% of events cluster below review threshold, your high-band gate may be too strict (missing real crashes).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geographic clustering&lt;/strong&gt; — false positives concentrated on specific routes often indicate road-surface triggers; tune Tough profile for those user segments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pair SDK event data with claims outcomes after 90 days to calibrate bands. The goal is a stable precision/recall trade-off documented for actuarial and operations stakeholders.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Peak G alone.&lt;/strong&gt; A 40 g spike without velocity context, duration, and multi-axis confirmation is not a crash. This is the most common DIY implementation mistake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One global threshold.&lt;/strong&gt; Urban gig drivers and rural fleet haulers need different profiles. Use segment-level tuning or user-group settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skipping reliability.&lt;/strong&gt; The platform computes confidence for a reason. Routing all Accident-type events to FNOL ignores it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No driver confirmation layer.&lt;/strong&gt; Medium-band prompts reduce false FNOL without sacrificing high-band automation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicating 15100 §4 in a second article.&lt;/strong&gt; Keep pipeline context on &lt;a href="https://damoov.com/how-automatic-crash-detection-works/" rel="noopener noreferrer"&gt;post 15100&lt;/a&gt;; keep false-positive depth here.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-automatic-crash-detection-works/" rel="noopener noreferrer"&gt;How Automatic Crash Detection Works&lt;/a&gt; — full detection pipeline, sensor fusion, FNOL.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/crash-detection-mobile-telematics/" rel="noopener noreferrer"&gt;Crash Detection with Mobile Telematics&lt;/a&gt; — business and use-case explainer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/crash-data" rel="noopener noreferrer"&gt;Crash Data&lt;/a&gt; — accident event payload and high-frequency buffer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/callbacks-and-listeners" rel="noopener noreferrer"&gt;Callbacks and Listeners&lt;/a&gt; — SDK event subscription reference.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ship crash detection that operations teams trust
&lt;/h2&gt;

&lt;p&gt;False-positive control is what separates a demo from a production crash detection deployment. The Damoov Telematics SDK implements multi-signal validation, severity-banded classification, and reliability scoring — so your team routes high-confidence events to FNOL and filters the rest before they reach a human.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://damoov.com/telematics-sdk/" rel="noopener noreferrer"&gt;Explore the Telematics SDK&lt;/a&gt; or read &lt;a href="https://docs.damoov.com/docs/crash-data" rel="noopener noreferrer"&gt;Crash Data&lt;/a&gt; to integrate accident event handling into your claims workflow.&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>telematics</category>
    </item>
    <item>
      <title>Background Trip Detection Without Killing the Battery: How Telematics SDKs Manage iOS and Android Background Modes</title>
      <dc:creator>Damoov</dc:creator>
      <pubDate>Fri, 31 Jul 2026 09:47:26 +0000</pubDate>
      <link>https://dev.to/damoov/background-trip-detection-without-killing-the-battery-how-telematics-sdks-manage-ios-and-android-jkl</link>
      <guid>https://dev.to/damoov/background-trip-detection-without-killing-the-battery-how-telematics-sdks-manage-ios-and-android-jkl</guid>
      <description>&lt;p&gt;Drivers do not uninstall telematics apps because the SDK integration was hard. They uninstall because the app drained their battery. Background location tracking is the highest-cost operation in any smartphone telematics product — and the platforms are explicitly designed to stop you from doing it continuously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Background location tracking battery drain&lt;/strong&gt; is the central engineering problem behind every always-on UBI, fleet, or gig-economy app. This article explains how a telematics SDK manages power across motion states, what iOS and Android actually allow in the background, and which configuration choices trade accuracy for battery life.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Already understand trip detection? See &lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;How Automatic Trip Detection Works&lt;/a&gt; for the motion state machine that drives when sensors spin up. For sensor fundamentals, start with &lt;a href="https://damoov.com/how-your-smartphone-understands-driving/" rel="noopener noreferrer"&gt;How Your Smartphone Detects Driving&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why battery is the make-or-break constraint
&lt;/h2&gt;

&lt;p&gt;Continuous GPS at 1 Hz can consume 5–10% of battery per hour on its own. Add accelerometer polling, network uploads, and a foreground service notification on Android, and a naive implementation becomes unusable within a day.&lt;/p&gt;

&lt;p&gt;The failure modes are predictable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User churn.&lt;/strong&gt; A 1-star review citing battery drain kills adoption faster than a missed crash event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OEM throttling.&lt;/strong&gt; Samsung, Xiaomi, Huawei, and OnePlus add battery managers beyond stock Android that kill background services aggressively.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS policy changes.&lt;/strong&gt; Every major iOS and Android release tightens background execution. An integration that worked in 2022 may be throttled in 2026 without SDK updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not zero battery cost — it is predictable, acceptable cost (typically 3–5% per day for a well-optimized always-on SDK) while maintaining trip detection reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power budget by motion state
&lt;/h2&gt;

&lt;p&gt;Efficient SDKs do not run the same sensor profile 24/7. Power consumption maps directly to the trip-detection state machine described in &lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;Article 1&lt;/a&gt; — each state uses a different duty cycle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IDLE&lt;/strong&gt; — near-zero cost. Activity recognition (iOS Core Motion / Android Activity Recognition API) runs at OS-managed power. No GPS. Accelerometer may sample at low frequency for motion energy only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CANDIDATE&lt;/strong&gt; — low cost. OS reports "in vehicle" transition; GPS may warm up briefly to confirm speed but does not record a full track yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DRIVING&lt;/strong&gt; — highest cost. Full GPS at ~1 Hz, accelerometer at 50–60 Hz, gyroscope active, network uploads queued. This is the only state where continuous location is justified.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The design principle: &lt;strong&gt;spend GPS budget only in DRIVING.&lt;/strong&gt; Everything else uses cheaper proxies to decide when to escalate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sampling profiles: what runs at what rate
&lt;/h2&gt;

&lt;p&gt;Understanding Hz profiles per state is the difference between a telematics app that survives and one that gets uninstalled:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sensor / API&lt;/th&gt;
&lt;th&gt;IDLE&lt;/th&gt;
&lt;th&gt;CANDIDATE&lt;/th&gt;
&lt;th&gt;DRIVING&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Activity recognition&lt;/td&gt;
&lt;td&gt;OS-managed (~0 extra cost)&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;td&gt;Active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accelerometer&lt;/td&gt;
&lt;td&gt;Low-rate motion energy&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;50–60 Hz&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPS&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;Burst / warm-up only&lt;/td&gt;
&lt;td&gt;~1 Hz continuous&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gyroscope&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;Active (cornering, crash)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network upload&lt;/td&gt;
&lt;td&gt;Heartbeat only (~2 hr)&lt;/td&gt;
&lt;td&gt;Minimal&lt;/td&gt;
&lt;td&gt;Trip chunks + events&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is materially deeper than the "adaptive sampling" summary in consumer explainers. The SDK's job is to enforce these profiles automatically so your app code never holds GPS open during idle hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  iOS: background modes and GPS cost tiers
&lt;/h2&gt;

&lt;p&gt;iOS offers several location APIs at very different power costs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Significant location change&lt;/strong&gt; — OS wakes your app when the device moves ~500 m. Near-zero idle cost. This is the primary wake path into CANDIDATE state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region monitoring&lt;/strong&gt; — geofence entry/exit triggers. Useful for fleet products with depot boundaries; not required for general trip detection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continuous location updates&lt;/strong&gt; — full GPS stream. Required during DRIVING, expensive. Only enabled after activity recognition confirms vehicle motion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Motion activity classification&lt;/strong&gt; — labels automotive / walking / cycling at minimal power. The cheap trigger before GPS escalation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additional iOS constraints that affect battery:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always authorization&lt;/strong&gt; is mandatory for background trip detection. "While Using" permission cannot record background trips.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low Power Mode&lt;/strong&gt; reduces location update frequency. The SDK should surface a user notification when Low Power Mode is active — trips may be missed or fragmented.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Precise Location&lt;/strong&gt; (iOS 14+) — reduced accuracy mode degrades trip quality. Monitor &lt;code&gt;accuracyAuthorization&lt;/code&gt; and prompt users to enable precise location.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See &lt;a href="https://docs.damoov.com/docs/permissions-in-ios" rel="noopener noreferrer"&gt;Permissions in iOS&lt;/a&gt; for the two-step Always authorization flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Android: foreground services, Doze, and OEM survival
&lt;/h2&gt;

&lt;p&gt;Android's background model is stricter in a different way: the system will kill your process unless you declare why you need to stay alive.&lt;/p&gt;

&lt;h3&gt;
  
  
  Foreground service trade-off
&lt;/h3&gt;

&lt;p&gt;During an active trip, a &lt;code&gt;FOREGROUND_SERVICE&lt;/code&gt; with a persistent notification is the reliable way to keep GPS recording without the system suspending your process. This costs battery (screen-on awareness, process priority) but is the cost of reliable DRIVING-state recording on Android 9+.&lt;/p&gt;

&lt;h3&gt;
  
  
  Doze and App Standby
&lt;/h3&gt;

&lt;p&gt;When the screen is off and the device is stationary, Doze mode batches network access and defers wake locks. Robust SDKs use &lt;strong&gt;activity transition callbacks&lt;/strong&gt; (not fixed-interval polling) so the app sleeps until the OS reports movement — avoiding wake loops that drain battery without producing trips.&lt;/p&gt;

&lt;h3&gt;
  
  
  Battery optimization exemption
&lt;/h3&gt;

&lt;p&gt;Stock Android's battery optimizer is the #1 cause of missing trips. Request exemption during onboarding:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;intent&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Intent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"package:${packageName}"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;startActivity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;intent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Manufacturer-specific killers
&lt;/h3&gt;

&lt;p&gt;Samsung Adaptive Battery, Xiaomi MIUI autostart restrictions, and Huawei power management go beyond stock Android. For these devices, guide users to manufacturer settings — reference &lt;a href="https://dontkillmyapp.com" rel="noopener noreferrer"&gt;dontkillmyapp.com&lt;/a&gt; for per-brand instructions. The Damoov React Native and Flutter permission wizards handle some of these cases automatically.&lt;/p&gt;

&lt;p&gt;Full permission sequence: &lt;a href="https://docs.damoov.com/docs/permissions-in-android" rel="noopener noreferrer"&gt;Permissions in Android&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  SDK configuration for power management
&lt;/h2&gt;

&lt;p&gt;Beyond platform APIs, the Damoov SDK exposes settings that directly affect power consumption:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;accuracy()&lt;/code&gt; — parking radius / location threshold. &lt;code&gt;accuracyHigh&lt;/code&gt; (default, 100 m) vs &lt;code&gt;accuracyLow&lt;/code&gt; trades GPS precision for fewer wake-ups near trip boundaries.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;stopTrackingTimeout()&lt;/code&gt; — dwell window before trip end. Shorter = faster trip finalization but more GPS time at low speed; longer = fewer fragmented trips but extended DRIVING-state cost.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;autoStartOn()&lt;/code&gt; — enables automatic background detection. Disable for on-demand products (taxi, delivery) that only record during active shifts.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;passiveDetectionOn()&lt;/code&gt; — alternative detection path for specific deployment modes. Evaluate against your accuracy requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Initialize with power-aware defaults (Android / Kotlin):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;settings&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;accuracy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accuracyHigh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stopTrackingTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stopTrackingTimeHigh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;autoStartOn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;passiveDetectionOn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nc"&gt;TrackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// After permissions granted:&lt;/span&gt;
&lt;span class="nc"&gt;TrackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setDeviceID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deviceId&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"YOUR_DEVICE_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;setEnableSdk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Initialize (iOS / Swift):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initializeSDK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;didFinishLaunchingWithOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;launchOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setDeviceID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;deviceId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"YOUR_DEVICE_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEnableSdk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For tracking modes beyond automatic (programmatic, on-demand, scheduled, Bluetooth-triggered), see the mode overview in &lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;Article 1&lt;/a&gt; — choosing the right mode is often the largest battery win because you stop recording entirely outside business hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring battery impact in production
&lt;/h2&gt;

&lt;p&gt;Lab estimates are not enough. Monitor these signals after launch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Device heartbeats&lt;/strong&gt; include battery level on each transmission (~every 2 hours). Trend battery drain for active vs inactive users. See &lt;a href="https://docs.damoov.com/docs/device-status" rel="noopener noreferrer"&gt;Device Status&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission + battery optimization state&lt;/strong&gt; in DataHub — correlate missing trips with users who denied background location or battery exemption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS version and manufacturer&lt;/strong&gt; — segment crash and missing-trip reports by device model. OEM-specific issues show up here first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User-reported uninstalls&lt;/strong&gt; — track app store reviews mentioning battery within 30 days of SDK enablement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A well-tuned deployment should show stable daily battery curves, not a cliff on day three when Samsung's Adaptive Battery kicks in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Holding GPS open in IDLE.&lt;/strong&gt; The most expensive mistake. If your app requests continuous location updates at init, you will drain battery before the first trip.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skipping battery optimization on Android.&lt;/strong&gt; Permissions granted but optimizer enabled = silent trip loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring Low Power Mode on iOS.&lt;/strong&gt; Trips fragment or disappear; users blame your app, not the OS setting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-size-fits-all accuracy.&lt;/strong&gt; Fleet products with depot geofences may tolerate &lt;code&gt;accuracyLow&lt;/code&gt;; UBI programs needing precise mileage should stay on &lt;code&gt;accuracyHigh&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building it yourself.&lt;/strong&gt; Duty-cycle management across iOS and Android revisions is ongoing maintenance — the reason teams buy an SDK.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;How Automatic Trip Detection Works&lt;/a&gt; — motion state machine and background APIs.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-your-smartphone-understands-driving/" rel="noopener noreferrer"&gt;How Your Smartphone Detects Driving&lt;/a&gt; — sensor primer.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/permissions-in-ios" rel="noopener noreferrer"&gt;Permissions in iOS&lt;/a&gt; — Always authorization flow.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/permissions-in-android" rel="noopener noreferrer"&gt;Permissions in Android&lt;/a&gt; — background location and battery exemption.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Record trips without draining the battery
&lt;/h2&gt;

&lt;p&gt;Background location tracking battery drain is solvable — but only with state-aware sensor management, platform-native wake paths, and SDK configuration tuned to your product's recording model. The Damoov Telematics SDK handles duty cycles, permission wizards, and OEM survival patterns so your team ships a battery-acceptable experience without rebuilding power management from scratch.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://damoov.com/telematics-sdk/" rel="noopener noreferrer"&gt;Explore the Telematics SDK&lt;/a&gt; or read the &lt;a href="https://docs.damoov.com/docs/permissions" rel="noopener noreferrer"&gt;permissions documentation&lt;/a&gt; to configure background tracking for your app.&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>telematics</category>
    </item>
    <item>
      <title>Detecting Location Spoofing in Mobile Telematics: How to Identify Fake GPS in Insurance and Fleet Apps</title>
      <dc:creator>Damoov</dc:creator>
      <pubDate>Tue, 21 Jul 2026 17:28:33 +0000</pubDate>
      <link>https://dev.to/damoov/detecting-location-spoofing-in-mobile-telematics-how-to-identify-fake-gps-in-insurance-and-fleet-e0i</link>
      <guid>https://dev.to/damoov/detecting-location-spoofing-in-mobile-telematics-how-to-identify-fake-gps-in-insurance-and-fleet-e0i</guid>
      <description>&lt;p&gt;Usage-based insurance premiums, fleet compliance dashboards, and gig-economy payout rules all assume one thing: the trips in your database reflect real driving. When a driver can feed your app a fabricated route — or selectively disable tracking in high-risk areas — every downstream score, mileage total, and fraud check becomes unreliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Location spoofing detection&lt;/strong&gt; is the set of techniques telematics platforms use to identify when smartphone location data may have been manipulated. This article walks through what spoofing looks like in mobile telematics, which signals actually indicate fraud, and how to build a practical integrity layer on top of your SDK integration — including Damoov's &lt;a href="https://docs.damoov.com/docs/trust-score" rel="noopener noreferrer"&gt;Trust Score&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Building trip recording first? See &lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;How Automatic Trip Detection Works&lt;/a&gt; for the sensor-fusion pipeline that produces the trip data you'll be validating here.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why telematics data integrity matters
&lt;/h2&gt;

&lt;p&gt;Smartphone telematics replaced hardware black boxes because deployment is cheaper and faster. The trade-off is trust: a dedicated OBD device is physically attached to the vehicle; a phone is a general-purpose computer that the driver controls.&lt;/p&gt;

&lt;p&gt;That control creates incentives to cheat:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Insurance UBI.&lt;/strong&gt; A policyholder who can suppress hard-braking events or inflate mileage in low-risk zones directly affects premium calculations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fleet compliance.&lt;/strong&gt; A driver who disables GPS during off-route detours avoids manager visibility without missing payroll hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gig and delivery platforms.&lt;/strong&gt; Fake GPS routes can simulate completed deliveries or mask location during policy violations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Detection is not about catching every edge case on day one. It is about building enough signal confidence that business decisions — underwriting, disciplinary action, payout approval — are defensible when challenged.&lt;/p&gt;

&lt;h2&gt;
  
  
  What location spoofing looks like on smartphones
&lt;/h2&gt;

&lt;p&gt;In mobile telematics, "spoofing" covers a range of behaviors, not just one attack vector:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mock location apps.&lt;/strong&gt; Android exposes a developer-level "mock location provider" that replays GPX routes or teleports the device. iOS has no equivalent public API, but jailbroken devices and certain sideloaded tools can inject coordinates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission manipulation.&lt;/strong&gt; Turning GPS off during specific trips, revoking background location access, or cycling permissions at trip boundaries to create gaps in the record.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selective recording.&lt;/strong&gt; Logging out, force-stopping the app, or switching devices so only favorable trips are captured.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Emulators and test environments.&lt;/strong&gt; Legitimate for QA — problematic when the same credentials record production trips from simulated routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The naive defense — "we only accept GPS coordinates" — fails because mock providers deliver coordinates that look valid until you cross-check them against motion sensors and permission state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detection signals that actually work
&lt;/h2&gt;

&lt;p&gt;No single flag proves fraud. Reliable &lt;strong&gt;location spoofing detection&lt;/strong&gt; combines platform signals, sensor coherence, and behavioral patterns over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Mock provider and platform flags
&lt;/h3&gt;

&lt;p&gt;On Android, the OS marks locations from mock providers. Your app or SDK can inspect this at the point of collection:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onLocationChanged&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isFromMockProvider&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Location originated from a mock provider — flag for review&lt;/span&gt;
        &lt;span class="c1"&gt;// Damoov's Trust Score incorporates this class of signal&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// Normal trip recording continues; backend scoring weighs integrity&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iOS does not expose an equivalent public flag on every location update, which is why cross-signal validation matters more on Apple devices.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Sensor–GPS coherence
&lt;/h3&gt;

&lt;p&gt;A real vehicle trip produces physically consistent data across sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accelerometer and gyroscope show braking, cornering, and vibration patterns that align with GPS speed changes.&lt;/li&gt;
&lt;li&gt;A teleport jump — coordinates shifting kilometers in one second while accelerometer energy stays flat — is a strong integrity violation.&lt;/li&gt;
&lt;li&gt;Reported speed that exceeds plausible vehicle limits for sustained intervals, without corresponding g-force, suggests injected coordinates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the same sensor-fusion discipline used in &lt;a href="https://damoov.com/how-automatic-crash-detection-works/" rel="noopener noreferrer"&gt;crash detection&lt;/a&gt;, applied to route plausibility rather than impact detection.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Permission and GPS toggling patterns
&lt;/h3&gt;

&lt;p&gt;Permission behavior is often more revealing than any single bad coordinate. Signals that reduce confidence include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPS disabled at trip start or end — the windows where manipulation has the highest payoff.&lt;/li&gt;
&lt;li&gt;Rapid on/off GPS cycles, especially at different geographic locations (suggesting selective avoidance).&lt;/li&gt;
&lt;li&gt;Background location or motion permissions revoked mid-program.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Damoov tracks these patterns through the &lt;a href="https://docs.damoov.com/docs/permissions-score" rel="noopener noreferrer"&gt;Permissions Score&lt;/a&gt;, which feeds directly into the broader Trust Score.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Account and device behavior
&lt;/h3&gt;

&lt;p&gt;Integrity problems often show up in metadata before they show up in a single trip:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frequent logins and logouts around trip windows.&lt;/li&gt;
&lt;li&gt;Multiple device switches on one account in a short period.&lt;/li&gt;
&lt;li&gt;Long gaps in uploads followed by bursts of "perfect" trips.&lt;/li&gt;
&lt;li&gt;Heartbeat reports showing SDK disabled while trips still appear (or the reverse).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Device status heartbeats — transmitted automatically by the SDK approximately every two hours — include permission state, tracking status, battery level, and connectivity. Monitoring these is the operational backbone of ongoing fraud detection. See &lt;a href="https://docs.damoov.com/docs/device-status" rel="noopener noreferrer"&gt;Device Status&lt;/a&gt; and the &lt;a href="https://docs.damoov.com/docs/device-status-api" rel="noopener noreferrer"&gt;Device Status API&lt;/a&gt; for field-level detail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trust Score: integrity scoring beyond a single trip
&lt;/h2&gt;

&lt;p&gt;Point-in-time checks catch obvious injections. Production telematics needs a rolling assessment of whether a user's entire data stream is trustworthy.&lt;/p&gt;

&lt;p&gt;Damoov's &lt;a href="https://docs.damoov.com/docs/trust-score" rel="noopener noreferrer"&gt;Trust Score&lt;/a&gt; aggregates three signal categories:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Permission-related activities&lt;/strong&gt; — GPS toggling, revocations, and background refresh interruptions (via Permissions Score).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account behavior&lt;/strong&gt; — login patterns, device switches, and indicators of mock-location tooling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telematics consistency&lt;/strong&gt; — continuity and coherence of location, motion, and sensor data across trips.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The score classifies users into three bands: &lt;strong&gt;Healthy&lt;/strong&gt; (above 90), &lt;strong&gt;Moderate&lt;/strong&gt; (80–90), and &lt;strong&gt;Attention required&lt;/strong&gt; (below 80). Full threshold definitions and use-case guidance are in the &lt;a href="https://docs.damoov.com/docs/trust-score" rel="noopener noreferrer"&gt;Trust Score documentation&lt;/a&gt; — this article does not duplicate that reference table.&lt;/p&gt;

&lt;p&gt;Trust Score is separate from driving behavior scores. A driver can be a safe driver with unreliable data — or vice versa. Underwriting and fleet compliance workflows should treat them independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing an integrity workflow
&lt;/h2&gt;

&lt;p&gt;A practical integration pattern for developers and backend teams:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Record trips normally&lt;/strong&gt; through the Telematics SDK with automatic detection enabled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscribe to backend notifications&lt;/strong&gt; for &lt;code&gt;HeartbeatReceived&lt;/code&gt; events to monitor permission state without polling. See &lt;a href="https://docs.damoov.com/docs/data-export" rel="noopener noreferrer"&gt;Data Export / Backend Notifications&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Query latest device status&lt;/strong&gt; when investigating a flagged user:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; GET &lt;span class="s2"&gt;"https://api.telematicssdk.com/v1/latest/users/YOUR_DEVICE_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer YOUR_JWT_TOKEN"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The response includes current permission states, SDK tracking status, and device metadata — enough context to decide whether a suspicious trip warrants exclusion or manual review.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Apply Trust Score thresholds in business logic.&lt;/strong&gt; Example policy rules:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Trust Score below 80 → exclude trips from premium calculation until permissions are restored and score recovers.&lt;/li&gt;
&lt;li&gt;Trust Score 80–90 → include trips but flag for manual review in DataHub.&lt;/li&gt;
&lt;li&gt;Trust Score above 90 → full automated processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Trust Score is visible per driver in &lt;a href="https://docs.damoov.com/docs/datahub" rel="noopener noreferrer"&gt;DataHub&lt;/a&gt; alongside safety and eco scores. Tune thresholds per product — insurance actuarial teams typically want a higher bar than gig platforms optimizing for driver retention.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do when integrity is low
&lt;/h2&gt;

&lt;p&gt;Detection without a user-facing response creates support debt. A workable playbook:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Notify in-app&lt;/strong&gt; when permissions drop below required levels — before scores are affected, not after.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explain the impact&lt;/strong&gt; in plain language: "We can't verify this trip because location access was disabled."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offer a remediation path&lt;/strong&gt; — permission wizard, link to OS settings, or support contact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log enforcement actions&lt;/strong&gt; — excluded trips, manual reviews, premium holds — for regulatory and dispute resolution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard-blocking every low-trust user on day one tends to increase churn without improving loss ratios. Most programs start with flag-and-review, then tighten automation as baseline trust distributions stabilize.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single-trip rejection only.&lt;/strong&gt; One clean trip does not rehabilitate a user with a pattern of GPS toggling. Use rolling Trust Score, not per-trip binary checks alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring permission UX.&lt;/strong&gt; Many "fraud" signals are accidental — users who revoked background location during an OS update. Distinguish malice from friction through heartbeat trends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building detection from GPS alone.&lt;/strong&gt; Without accelerometer coherence and permission auditing, mock routes pass basic validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reimplementing platform scoring.&lt;/strong&gt; Trust Score, Permissions Score, and heartbeat infrastructure exist precisely so integrators do not rebuild integrity models from scratch.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-automatic-trip-detection-works/" rel="noopener noreferrer"&gt;How Automatic Trip Detection Works&lt;/a&gt; — the trip pipeline whose output you'll validate.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/permissions-score" rel="noopener noreferrer"&gt;Permissions Score&lt;/a&gt; — permission-specific integrity signals.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.damoov.com/docs/trust-score" rel="noopener noreferrer"&gt;Trust Score&lt;/a&gt; — full scoring reference and thresholds.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/telematics-api/" rel="noopener noreferrer"&gt;Telematics API&lt;/a&gt; — platform APIs for trips, scores, and device status.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Ship telematics with integrity built in
&lt;/h2&gt;

&lt;p&gt;Location spoofing is an expected adversary in smartphone telematics — not an edge case. The integrators who treat data integrity as a first-class product requirement earn trust from insurers, fleet operators, and compliance teams before a dispute forces the conversation.&lt;/p&gt;

&lt;p&gt;The Damoov Telematics SDK records trips with sensor fusion, monitors permissions through device heartbeats, and surfaces integrity through Trust Score — so your team can focus on product logic instead of rebuilding fraud detection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://damoov.com/telematics-sdk/" rel="noopener noreferrer"&gt;Explore the Telematics SDK&lt;/a&gt; or read the &lt;a href="https://docs.damoov.com/docs/trust-score" rel="noopener noreferrer"&gt;Trust Score documentation&lt;/a&gt; to integrate integrity scoring into your workflow.&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>telematics</category>
    </item>
    <item>
      <title>How Automatic Trip Detection Works: Sensor Fusion, Motion States, and Background Processing in Mobile Telematics SDKs</title>
      <dc:creator>Damoov</dc:creator>
      <pubDate>Mon, 13 Jul 2026 14:35:04 +0000</pubDate>
      <link>https://dev.to/damoov/how-automatic-trip-detection-works-sensor-fusion-motion-states-and-background-processing-in-1m2l</link>
      <guid>https://dev.to/damoov/how-automatic-trip-detection-works-sensor-fusion-motion-states-and-background-processing-in-1m2l</guid>
      <description>&lt;p&gt;Every telematics feature — driver scoring, crash detection, mileage, usage-based insurance — depends on one unglamorous prerequisite: knowing when a drive starts and when it ends. Get that wrong and everything downstream is wrong. Record a train ride as a car trip and you have garbage in the risk model. Miss the first two minutes of a drive and you lose the hard acceleration that matters most. Drain the battery polling GPS all day and users uninstall the app before you ever score a trip.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automatic trip detection&lt;/strong&gt; is the process of recognizing vehicle trips from a smartphone in the background, with no button for the driver to press. This article is a practitioner's walk-through of how it actually works: the sensors, the motion state machine, the trip start/stop logic, and the platform constraints that make "just track location" much harder than it sounds.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;New to the raw sensors themselves? Start with &lt;a href="https://damoov.com/how-your-smartphone-understands-driving/" rel="noopener noreferrer"&gt;How Your Smartphone Detects Driving&lt;/a&gt; for a primer on the accelerometer, gyroscope, magnetometer, and GPS. This article assumes that foundation and focuses on the trip-detection pipeline built on top of it.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why automatic trip detection is hard
&lt;/h2&gt;

&lt;p&gt;The naive approach — "start recording when speed &amp;gt; 0, stop when speed = 0" — fails immediately in the real world:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Passenger trips.&lt;/strong&gt; The phone can't tell a driver from a passenger on sensor data alone. Business logic and post-trip signals have to disambiguate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Other transport.&lt;/strong&gt; Trains, buses, trams, and even fast cycling produce vehicle-like speed and acceleration. Detecting "in a vehicle" is not the same as "driving a car."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stops mid-trip.&lt;/strong&gt; Traffic lights, drive-throughs, and gridlock all produce zero speed. Ending a trip at every red light shatters one drive into twenty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parking-lot creep and GPS drift.&lt;/strong&gt; A stationary phone can report phantom movement from GPS noise, especially between tall buildings ("urban canyon").&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Battery and OS limits.&lt;/strong&gt; Neither iOS nor Android will let an app hold GPS at full power indefinitely. Detection has to be cheap when idle and precise only when it matters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Solving these at once is why trip detection is a sensor-fusion and state-machine problem, not a threshold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sensor fusion, briefly
&lt;/h2&gt;

&lt;p&gt;Trip detection combines several independent signals so the weaknesses of one are covered by the strengths of another:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accelerometer&lt;/strong&gt; — motion energy and acceleration/braking signatures; cheap to sample continuously.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gyroscope&lt;/strong&gt; — rotation and cornering; helps separate vehicle dynamics from a phone being handled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Magnetometer&lt;/strong&gt; — heading/orientation context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPS&lt;/strong&gt; — ground-truth speed and location, but power-hungry and unreliable indoors or in urban canyons.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OS activity recognition&lt;/strong&gt; — the platform's own classifier (iOS Core Motion, Android Activity Recognition) that labels &lt;em&gt;walking / cycling / automotive / still&lt;/em&gt; at near-zero power cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The important design point: &lt;strong&gt;GPS is the expensive confirmation, not the trigger.&lt;/strong&gt; Cheap sensors (activity recognition + accelerometer) decide &lt;em&gt;probably driving&lt;/em&gt;; GPS is spun up to confirm and to record the route. This is the core of keeping battery drain low — a topic we go deeper on in a separate article on background battery management.&lt;/p&gt;

&lt;h2&gt;
  
  
  The motion state machine
&lt;/h2&gt;

&lt;p&gt;Reliable trip detection is best modeled as a state machine rather than a set of if-statements. A driver moves between a small number of states, and transitions are debounced so a single noisy reading can't flip the state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IDLE → CANDIDATE:&lt;/strong&gt; the OS activity classifier reports "automotive" (or accelerometer motion energy crosses a threshold). No GPS yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CANDIDATE → DRIVING:&lt;/strong&gt; GPS is activated and confirms sustained vehicle speed over a few seconds. This debounce rejects a phone tossed on a seat or a brief bus hop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DRIVING → TRIP END:&lt;/strong&gt; speed stays near zero for a configured dwell window (e.g., several minutes), distinguishing a real trip end from a red light.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TRIP END → IDLE:&lt;/strong&gt; the trip is finalized, uploaded, and the pipeline returns to the low-power idle state.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Trip start detection
&lt;/h2&gt;

&lt;p&gt;The goal at the start boundary is to begin recording as early as possible without triggering on non-drives. In practice that means a two-stage gate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cheap trigger:&lt;/strong&gt; the activity-recognition classifier transitions to &lt;em&gt;in-vehicle&lt;/em&gt;, or accelerometer energy indicates transport. This costs almost no battery and can run 24/7.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confirmation:&lt;/strong&gt; GPS activates and must observe sustained speed above a walking/cycling threshold for a short window before the state commits to DRIVING.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because the cheap trigger fires first, a good implementation back-fills the first seconds of the trip from a short rolling buffer, so the early acceleration isn't lost while GPS is warming up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trip end detection
&lt;/h2&gt;

&lt;p&gt;Ending a trip is where naive implementations fall apart. The rule is not "speed = 0" but "speed ≈ 0 &lt;em&gt;and stays there&lt;/em&gt;." A dwell timer holds the DRIVING state through stops; only when the vehicle has been stationary for the full window does the trip finalize. Set the window too short and one drive becomes many fragments; too long and a quick errand and the drive home merge into one. This is deliberately configurable per deployment because a rideshare product and a long-haul fleet want different behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background processing: the platform reality
&lt;/h2&gt;

&lt;p&gt;All of this has to run when the app is backgrounded or the screen is off — under OS rules explicitly designed to stop apps from doing exactly this.&lt;/p&gt;

&lt;h3&gt;
  
  
  iOS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always authorization&lt;/strong&gt; for location is required for background trip detection; the SDK must handle the permission wizard and the "provisional always" prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Significant-location-change and region monitoring&lt;/strong&gt; let the app stay dormant and be woken by the OS when the device moves meaningfully — the low-power path into the CANDIDATE state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Motion&lt;/strong&gt; provides activity classification without holding GPS.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;location&lt;/code&gt; background mode keeps updates flowing during an active trip.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Android
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;foreground service&lt;/strong&gt; with a persistent notification is the reliable way to record an active trip without the system killing the process.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Activity Recognition API&lt;/strong&gt; provides the cheap in-vehicle trigger; &lt;code&gt;ACCESS_BACKGROUND_LOCATION&lt;/code&gt; (Android 10+) is required for detection while backgrounded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Doze mode and OEM battery managers&lt;/strong&gt; aggressively suspend background work; robust SDKs use activity-transition callbacks (not fixed polling) so the app sleeps until the OS reports movement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pattern on both platforms is the same: stay asleep, let the OS wake you cheaply on movement, and only then escalate to GPS. Fighting the platform's power model is how you end up with a battery-draining app that gets throttled anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tracking modes in practice
&lt;/h2&gt;

&lt;p&gt;"Automatic" is the right default, but real products need control over &lt;em&gt;when&lt;/em&gt; the SDK records. The Damoov Telematics SDK exposes five tracking modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automatic&lt;/strong&gt; — runs in the background and detects trip start/stop with no user action. The default for continuous UBI and driver-safety products.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programmatic&lt;/strong&gt; — your app starts and stops tracking through its own flow. Best for taxi and delivery apps where only on-duty trips should be recorded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-demand&lt;/strong&gt; — you control exactly when tracking begins and ends, for time-bound scenarios like rentals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scheduled&lt;/strong&gt; — calendar-based windows, ideal for corporate drivers with fixed shifts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bluetooth device&lt;/strong&gt; — tracking is tied to a specific vehicle's Bluetooth device, so recording starts only when the driver is in &lt;em&gt;that&lt;/em&gt; car — useful when a driver has multiple vehicles but only one should be tracked.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementing it with the Damoov SDK
&lt;/h2&gt;

&lt;p&gt;In automatic mode, you initialize the SDK once, enable it after permissions are granted, and subscribe to the trip lifecycle. Detection runs from there without further app involvement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Initialize (Android / Kotlin):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In Application.onCreate()&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;settings&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;accuracy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Settings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accuracyHigh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;autoStartOn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;          &lt;span class="c1"&gt;// enable automatic trip detection&lt;/span&gt;

&lt;span class="nc"&gt;TrackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// After the location/motion permission wizard completes:&lt;/span&gt;
&lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;trackingApi&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TrackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;trackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setDeviceID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deviceId&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"YOUR_DEVICE_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;trackingApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEnableSdk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Subscribe to the trip lifecycle (Android / Kotlin):&lt;/strong&gt; the SDK reports trip boundaries through listener callbacks — you don't poll for them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onStartTracking&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// A trip has started — DRIVING state entered&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onStopTracking&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// A trip has ended and been finalized — safe to read the recorded trip&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onLocationChanged&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Streamed waypoints during an active trip&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="k"&gt;fun&lt;/span&gt; &lt;span class="nf"&gt;onNewEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Driving events for the trip (harsh braking, acceleration, accidents, ...)&lt;/span&gt;
    &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;accidents&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;events&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;type&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"Accident"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Initialize (iOS / Swift):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="c1"&gt;// AppDelegate — didFinishLaunchingWithOptions&lt;/span&gt;
&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initializeSDK&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;didFinishLaunchingWithOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;launchOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;// After the permissions wizard completes:&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setDeviceID&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;deviceId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"YOUR_DEVICE_TOKEN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kt"&gt;RPEntry&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setEnableSdk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;autoStartOn(true)&lt;/code&gt; flag is the switch that turns on automatic trip detection: with it set, the state machine described above runs inside the SDK, and your app just reacts to &lt;code&gt;onStartTracking&lt;/code&gt; / &lt;code&gt;onStopTracking&lt;/code&gt;. For the full callback reference, see the &lt;a href="https://docs.damoov.com/docs/callbacks-and-listeners" rel="noopener noreferrer"&gt;Callbacks &amp;amp; Listeners&lt;/a&gt; documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common pitfalls and trade-offs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chasing zero false-negatives.&lt;/strong&gt; Making the start trigger too sensitive catches every short walk and bus ride. Tune for precision first; a missed 30-second parking-lot move matters less than a corrupted risk profile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trip fragmentation.&lt;/strong&gt; Too-short a dwell window splits one commute into many trips and wrecks per-trip scoring. Validate the end-of-trip window against real driving data for your market.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Under-provisioned permissions.&lt;/strong&gt; Background detection simply cannot work without "Always" (iOS) and background location (Android). Design the permission flow as a first-class part of onboarding, not an afterthought.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building it yourself.&lt;/strong&gt; Every item above — activity transitions, GPS warm-up buffering, dwell tuning, Doze survival, permission wizards — is months of platform-specific work that has to be re-validated with every OS release. That's the maintenance cost an SDK absorbs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Related reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-your-smartphone-understands-driving/" rel="noopener noreferrer"&gt;How Your Smartphone Detects Driving&lt;/a&gt; — the underlying sensors, explained.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://damoov.com/how-automatic-crash-detection-works/" rel="noopener noreferrer"&gt;How Automatic Crash Detection Works&lt;/a&gt; — the same sensor-fusion foundation applied to detecting collisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Build on trip detection instead of rebuilding it
&lt;/h2&gt;

&lt;p&gt;Automatic trip detection is deceptively deep: a state machine over fused sensors, tuned against the messy reality of passengers, red lights, and OS power limits. The Damoov Telematics SDK ships all of it — automatic detection, five tracking modes, and a clean callback API — so you can start from recorded, scored trips instead of from an empty accelerometer buffer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://damoov.com/telematics-sdk/" rel="noopener noreferrer"&gt;Explore the Telematics SDK&lt;/a&gt; or head straight to the &lt;a href="https://docs.damoov.com/" rel="noopener noreferrer"&gt;developer documentation&lt;/a&gt; to integrate trip detection into your app.&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>android</category>
      <category>ios</category>
      <category>telematics</category>
    </item>
  </channel>
</rss>
