ALL BUSINESS
COMIDA
DIRECTORIES
EDUCATIONAL
ENTERTAINMENT
FASHION TIPS
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TELEVISION NETWORKS
USA VOTES 2024
VIDEOS
INVESTOR RELATIONS
IN DEVELOPMENT
Posted by - Latinos MediaSyndication -
on - May 30, 2023 -
Filed in - Technology -
-
385 Views - 0 Comments - 0 Likes - 0 Reviews
I have an application that works like a fitness tracker. The user starts recording a path, locks the phone and puts it in a pocket. After a few minutes the phone is unlocked and the path is expected to have been recorded.
This works for most users but in some cases it seems that locations is only tracked when the phone is not locked. So if the user unlocks the phone a few times while recording you can see these points in the result afterwards, but between the points where the phone was unlocked there are no points at all.
I can not recreate this issue on an iPhone 11 but it appears on an iPhone 13 pro for instance. I am looking for suggestions on how to recreate this issue as I don't know what is causing it.
This is how I start the foreground task that is tracking the location:
await Location.startLocationUpdatesAsync(TRACKING_BACKGROUND_TASK, { distanceInterval: 1, accuracy: LocationAccuracy.BestForNavigation, activityType: Location.LocationActivityType.OtherNavigation, foregroundService: { notificationTitle: "App name", notificationBody: "Tracking", }, });
Before that I have requested foreground permissions:
Location.requestForegroundPermissionsAsync()
This is my foreground task:
TaskManager.defineTask( TRACKING_BACKGROUND_TASK, (body: TaskManager.TaskManagerTaskBody<object>) => { if (body.error) { console.error(body.error.message); return; } const data = body.data as unknown as { locations: LocationObject[] }; const locations = data?.locations; if (!locations) { return; } for (const location of locations) { for (const callback of Object.values(locationCallbacks)) { callback(location); } } } );
I don't think that there are so many things to configure, this is quite straight forward so I don't know what to try. Is there any external circumstances that could possibly be the source to this issue?