Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/691a5ca1-2b1c-8010-8cbd-8797f95aa8d9
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: Yeah, your instinct is spot-on: === Yeah, your instinct is spot-on: * User-started “driving sessions” * Location + motion as enrichment + redundancy * Optional Live Activity as the “UI surface” for the session is exactly how I’d sell/architect this. Let me structure it around your ideas. ==== 1. “Start Driving Session” as the core ==== Totally agree: no realistic, App-Review-friendly app is doing precise continuous tracking when it’s been fully killed. So: * User taps Start driving * You: - Request / confirm Location, Motion, and Notification permissions - Start your DrivingSession in your persistence layer - Enable background location - Start Core Motion updates - Optionally start a Live Activity This ticks all of Apple’s boxes: * User-initiated * Clear modal behavior: “I am driving now” * Easy to explain in review notes (“when the user starts a driving session, we track time and occasionally notify them to rest”). ==== 2. Why adding GPS is absolutely worth it ==== You’re not just doing this to keep the app alive — you get a ton of extra signal: # Distance & route insights - Integrate with CLLocationManager: - Accumulate total distance - Optionally store a low-frequency “breadcrumb trail” (e.g. every 1–2 minutes) for a post-drive map. - These can feed: - “You drove 240 km today” - Per-session stats (avg speed, max speed, etc.) # Speed validation / redundancy - Combine: - CMMotionActivity.automotive - GPS speed - Use speed thresholds to: - Ignore weird .automotive when the user is walking near a road - Detect “moving but not driving” vs “clearly driving” - You can also use speed drop + long stationary intervals to auto-pause/end sessions if the user forgets to tap Stop. # Weather at route segments (if you want to get fancy) - If the product ever wants weather: - Grab the start location and maybe a few intermediate points - Fetch weather when online (current or historical depending on API). - Then you can show “You drove X km in rainy conditions” etc. - This fits nicely with your offline-first stance: store location points locally, only fetch weather opportunistically when online / user views history. # POIs & “break suggestions” (future idea) - With GPS + distance + time, you can later add: - “Suggest nearby rest stops after 3.5h driving” - “Log where you took breaks” All of that turns “we just need 4h timer” into a useful driving log, which makes your permission requests much easier to justify. ==== 3. Live Activity as the “session HUD” ==== Yep, a Live Activity is a really natural fit here: What it can show: * Elapsed driving time (e.g. 3h 12m) * Time remaining until the 4-h break (e.g. 48m to mandatory break) * Maybe: - Distance so far - Current speed (rounded / smoothed) - Simple state: “Driving / On break” Why it’s useful: * Shows up on the Lock Screen + Dynamic Island while they’re driving * Gives a persistent “this is running” indicator even if your main app UI is closed * You can update it locally (no need for push) as long as the app has some runtime (foreground or location-kept in background) Constraints to keep in mind: * You don’t want to spam updates every second (battery + ActivityKit limits). - For a driving app, updating every 15–60 seconds is usually enough: - The main important values (elapsed time, time to break) don’t need second-precision. * Live Activity doesn’t itself keep your app alive forever: - It’s a surface you update while you have background execution (e.g. via location). - It’s perfect as a display + “quick access” to the session, not as the core engine. So the pattern is: # User taps Start driving # You: - Start the session in your own model - Start background location + motion - Start a Live Activity representing that session # Your engine updates: - Local state (driving time, distance, etc.) - Live Activity state (via ActivityKit) # When user taps Stop driving: - Finish session in storage - Stop location + motion - End the Live Activity ==== 4. How I’d wire motion + GPS + notifications + Live Activity together ==== High-level flow: ===== A. On “Start driving” ===== * Persist a new DrivingSession with startDate. * CLLocationManager: - activityType = .automotiveNavigation (or appropriate) - allowsBackgroundLocationUpdates = true - Reasonable desiredAccuracy / distanceFilter. * CMMotionActivityManager: - Start activity updates to refine “driving vs stopped”. * UNUserNotificationCenter: - Schedule a 4h local notification from “now” as a baseline. - Optionally schedule a 3h30 “pre-break” reminder. * ActivityKit: - Start a Live Activity with: - elapsed at 0 - targetBreakTime = now + 4h - optional fields: distance, average speed. ===== B. While session is running ===== Your engine (actor / object) receives: * Motion updates → determine “currently driving or not” * Location updates → compute: - distance - speed - optionally use timestamp deltas for more accurate time accounting. The engine: * Maintains driving seconds (don’t rely on a timer; use timestamps). * Whenever state changes enough (e.g. every 30s or significant change), it: - Updates Live Activity with the latest stats. - Optionally adjusts the planned notification fire time if your logic changes - But you can also keep it simple and just fire at exactly 4h from when they tapped Start. ===== C. On “Stop driving” ===== * Close the session (store endDate, total time, distance, etc.). * Cancel any future driving-specific notifications (if desired). * End Live Activity. ==== 5. UX + App Review story ==== You now have a clean, defensible story: * The app doesn’t try to “spy” in the background all day. * The user explicitly starts a driving session (like starting navigation or a workout). * During that session you: - Use location + motion to track driving time, distance, and speed. - Show a Live Activity HUD for quick glanceable info. - Trigger local notifications when they’ve been driving too long and should rest. If your dev friend wants to go deeper, we can: * Sketch a concrete DrivingSession model and DrivingEngine actor * Draft the Live Activity attributes/content state * Outline the permission flow and “why we need GPS” copy in Settings/Onboarding …but conceptually, yes: your proposed combo (manual session + motion + GPS + optional Live Activity) is exactly the sane way to do this on iOS without servers.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)