HOCO B2B
Team tasksImad

MDA-12 — Delegate app — location sampling during tours

Policy-driven sampling only while a tour is in progress, batching, battery-friendly settings, foreground-service notice on Android.

FieldDetails
Task codeMDA-12
PhaseP1 — V1 build & integration
Product scopeV1
StatusPlanned
StartTue 15 Dec 2026
DueTue 15 Dec 2026
ResponsibleImad — Mobile developer (Flutter)
Co-responsible—
Effort0.75 person-day(s) planned · 3 from scratch · size S
Area · appDelegate app · mobile
Depends onMOB-10
UnblocksMOB-12
MilestonesMobile apps V1 feature-complete

Summary

Policy-driven sampling only while a tour is in progress, batching, battery-friendly settings, foreground-service notice on Android.

Description

The back-office follows delegates on tour live (FLD-13), but positions may only be collected while a tour is in progress, at the policy's frequency, transparently and with consent (FLD-15, SEC-07). Scope: policy-driven sampling that starts when a tour becomes IN_PROGRESS and stops on suspend, close or sign-out; every 5 min or 200 m (values from the server policy); an Android foreground service with a persistent notification; local buffering in drift and batched upload through POST /delegate/location-pings (sync.locationPings, Idempotency-Key per batch, occurredAt per ping); battery-friendly settings. It needs the sampling policy fields from Anis (SRV-21/SRV-23) and the consent flow from MOB-10. The back-office live map (DSH) and MOB-13's battery measurements depend on it.

Subtasks

#SubtaskOwner
1SamplingController reacting to TourStatus: start on IN_PROGRESS, stop on SUSPENDED, COMPLETED, CANCELLED, sign-out or consent withdrawal; resumes on relaunch if the tour is still IN_PROGRESSImad
2Android foreground service (geolocator ForegroundNotificationConfig, foregroundServiceType location for Android 14) with notification « Tournée en cours — votre position est partagée avec HOCO »Imad
3Sampling rule: a ping every policy.intervalMinutes (default 5) or after policy.distanceMeters (default 200), balanced accuracy, accuracy and mock flag recordedImad
4location_pings drift table (id, lat, lng, accuracy, speed, occurredAt, tourId, sent) with local pruning after acknowledgment and never beyond 72 hImad
5Batch uploader: POST /delegate/location-pings every 10 min or 20 pings when online, Idempotency-Key per batch, retry on failureImad
6Battery and OEM handling: guide to exclude the app from battery optimisation (Xiaomi, Oppo, Samsung), pause sampling in battery saver only if the policy allowsImad
7Battery-drain measurement script (adb dumpsys batterystats) for a 4-hour simulated tourImad

Deliverables

  • packages/hoco_maps/lib/src/sampling/ (controller, foreground service config)
  • packages/hoco_offline location_pings table and batch uploader
  • Battery measurement notes for MOB-13

Acceptance criteria

  • No position is recorded or sent when no tour is IN_PROGRESS, including while suspended (FLD-15, SEC-07)
  • During a tour, pings arrive at the configured interval or distance; changing the policy on the server changes the behaviour without a release
  • The persistent notification is visible for the whole time sampling runs
  • Pings recorded offline are uploaded on reconnection with their original occurredAt and no duplicates
  • Battery drain over a 4-hour tour stays within the target agreed with Anis (proposed ≤ 3 % per hour on a mid-range phone)

Requirements covered

RequirementTitleRelease
FLD-13Live follow-up in the back-office: delegates on tour, positions, visit progressV1
FLD-15Location policy: consent, frequency, tolerance and retention configurable and transparentV1
SEC-07Geolocation consent and transparency for delegatesV1

API surface

Endpoint groupOperations
Offline sync & location3

Test measures

  • Unit tests of the SamplingController state machine against TourStatus transitions
  • Device test with a simulated route (mock location app in a debug build) verifying interval/distance rules
  • Battery drain measurement on two mid-range Android phones

Risks

  • OEM task killers stop the foreground service — onboarding tip for battery exemptions and a check-in-time ping as a fallback
  • Play Store foreground-service declaration review — keep sampling strictly tied to the visible tour feature and record the demo video early (MOB-14)

KPI

  • Delivered by Tue 15 Dec 2026 within 0.75 person-day(s).
  • Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
  • Zero open critical defects, permission gaps or data-integrity regressions at sign-off.

Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.

On this page