Post

Replies

Boosts

Views

Activity

Keep tracking user driving sessions when the app is killed.
I want a solution to keep tracking the user once he started in driving state until parking. I tried many solutions like use significant location changes, and silent push notifications and background tasks, but no one of them worked as expected. I need when user started in driving the app be active until the user parked his car. I'm using CoreMotion and CoreLocation. The challenge is when the app is not active like killed or suspended. So, how to do this? is this possible or not?
1
0
211
6d
Tracking User Activity (Driving/Walking) Periodically with Background Execution (Background state & Terminated state)
I'm working on an application where, once the user starts driving, I need to periodically check their activity every 2.5 minutes (150 seconds) to determine whether they are still driving, walking, or have stopped. If they are still driving, I want to keep rescheduling the task until the user is no longer in a driving state. Currently, I'm using startMonitoringSignificantLocationChanges to wake the app when the user's location changes, which works as expected. However, the activity detection stops after the first result is received, and I can't continue tracking the user's activity in the background (or after the app is killed from the app switcher). Here's my approach: After receiving a significant location change, I start tracking the user’s activity to check if they are driving or have stopped. I reschedule this task every 2.5 minutes as long as the user remains in a driving state. I need this process to run even when the app is in the background or terminated by the user. Question: Is it possible to keep activity detection running periodically after receiving a location change, even when the app is in the background or terminated? What is the recommended way to implement this? I would appreciate any suggestions or best practices for achieving this functionality.
1
0
405
Dec ’24