question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TaskManager doesn't work on iOS standalone app

See original GitHub issue

🐛 Bug Report

Summary of Issue

I made an app which uses the background location for geotracking of the user. I use the TaskManager to implement that approach. On Android, it works fine; on iOS, only works when I test the app in Expo Client (Custom), but in the standalone it doesn’t work very well. I even followed the steps that you give me in the following link to put the TaskManager running in iOS standalone apps: https://docs.expo.io/versions/latest/sdk/task-manager/.

Environment - output of expo diagnostics & the platform(s) you’re targeting

Output of expo diagnostics

Expo CLI 3.22.0 environment info: System: OS: Windows 10 10.0.19041 Binaries: Node: 12.18.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 4.6.1 - C:\Program Files\nodejs\npm.CMD npmPackages: expo: ~36.0.0 => 36.0.2 react: ~16.9.0 => 16.9.0 react-dom: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 react-native-web: ~0.11.7 => 0.11.7 react-navigation: ^4.3.1 => 4.4.0

Platforms that I’m targetting: Android and iOS

Reproducible Demo

bottom.jsx

// Executa-se as notiicações de geolocalização que correm em background TaskManager.defineTask(LOCATION_TASK_NAME, ({ data, error }) => { if (error) { // Error occurred - checkerror.messagefor more details. Alert.alert('A geolocalização só funciona em smartphones.'); return; } if (data) { const { locations } = data; // do something with the locations captured in the background add(); console.log(counter); // if (counter % 2 != 0) { console.log('Aqui têm as vossas coordenadas!'); console.log(data.locations[0].coords.latitude); console.log(data.locations[0].coords.longitude); // Aqui, ao recolher as coordenadas, invoca cada função para fazer qualquer operação com elas notificacoesPerdidas(data.locations[0].coords.latitude, data.locations[0].coords.longitude); // mask(data.locations[0].coords.latitude, data.locations[0].coords.longitude); // } } }); await Location.startLocationUpdatesAsync(LOCATION_TASK_NAME, { accuracy: Location.Accuracy.High, distanceInterval: 10 }); app.json { "expo":{ ..., "ios": { "supportsTablet": true, "bundleIdentifier": "com.on.dica", "buildNumber": "4.1.2", "config": { "googleSignIn": { "reservedClientId": "com.googleusercontent.apps.712914569696-qe8gq455d7gi5b3hj79eit5eu02tu1g2" } }, "infoPlist": { "UIBackgroundModes": [ "location", "fetch" ] } }, ... } }

Steps to Reproduce

  1. Include the following code in app.json: { "expo": { ... "ios": { ... "infoPlist": { ... "UIBackgroundModes": [ "location", "fetch" ] } } } }

  2. Test the app in custom Expo Client for ios (it worked fine)

  3. Run expo build:ios to build the iOS standalone app

  4. Test the standalone app in TestFlight

Expected Behavior vs Actual Behavior

Expected Behavior The app should give the local geolocation notifications, runned by TaskManager

Actual Behavior The app is not giving the notifications.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brentvatnecommented, Oct 31, 2020

@thimo1 - make sure that you rebuild after setting that in app.json, it can’t be updated OTA

0reactions
stale[bot]commented, Mar 19, 2021

This issue has been automatically closed since there has not been any recent activity after it was marked as stale. Please open a new issue for any related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Motion: Tasks and Scheduling 4+ - App Store - Apple
The perfect mobile app for Motion's all in one time manager - for managing tasks and scheduling meetings while on-the-go. You can quickly...
Read more >
RN app does not build after expo-task-manager installation
My app ran fine until the expo-task-manager installation. The IOS app builds and works as expected, tasks are created and work as they ......
Read more >
TaskManager - Expo Documentation
TaskManager works out of the box in the Expo Go app on Android, but on iOS you'll need to test using a development...
Read more >
The all-new Things. Your to-do list for Mac & iOS
Things is the award-winning personal task manager that helps you plan your day, ... It's the rare to-do list app that doesn't try...
Read more >
How To Run Apps From The Task Manager On ... - AddictiveTips
You can use it quit apps, and stop services. If you have an app that's stuck or unresponsive, you most likely open the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found