Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location.startLocationUpdatesAsync task callback does not receive any location updates on Android #28959

Closed
Bashin opened this issue May 18, 2024 · 10 comments · Fixed by #29024
Closed
Assignees

Comments

@Bashin
Copy link

Bashin commented May 18, 2024

Minimal reproducible example

https://github.com/santibernas/expo-issue-28767

What platform(s) does this occur on?

Android

Did you reproduce this issue in a development build?

Yes

Summary

When using Location.startLocationUpdatesAsync to register a TaskManager task the task is registered successfully (verified by TaskManager.getRegisteredTasksAsync) but the callback does not ever get called with location data or even an error on Android.

Here are some Logcat insights.

Initially:
Registered task with name 'LocationTask' for app with scoping identifier 'test.app'.

Thereafter every second:
Handling intent with task name 'LocationTask' and app scoping identifier 'test.app'.
Handling job with task name 'LocationTask' for app with scoping identifier 'test.app'.

After a few minutes (usually less than 15) the app runs out of memory and restarts.

On IOS everything works fine and in SDK 50 with the respective package versions of expo-task-manager and expo-location everything was working on Android as well.

Environment

expo-env-info 1.2.0 environment info:
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
Yarn: 3.6.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: AI-233.14808.21.2331.11709847
npmPackages:
expo: ~51.0.8 => 51.0.8
react: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
Expo Workflow: bare

Expo Doctor Diagnostics

WARNING: We recommend using PowerShell or Bash via WSL 2 for development with Expo CLI on Windows. You may encounter issues using cmd.exe.

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check native tooling versions
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check that packages match versions required by installed Expo SDK

Didn't find any issues with the project!

@Bashin Bashin added the needs validation Issue needs to be validated label May 18, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 18, 2024
@Bashin
Copy link
Author

Bashin commented May 18, 2024

Please also note the same problem being reported in the comments of this issue:
#28767

This issue was created on request of @brentvatne and the sample app is by @santibernas

@shuo-hiwintech
Copy link

Same question.

@behenate
Copy link
Member

@Bashin Hi, are you using the new architecture? Also does the location never work for you or only on the first launch like in this issue? #26373

@Bashin
Copy link
Author

Bashin commented May 20, 2024

Hi @behenate I am not using the new architecture and I have no issues at all on iOS (unlike the issue you mentioned). However, I am unable to receive any location on Android, neither in a dev build nor in production.

@fbinz
Copy link

fbinz commented May 20, 2024

Can also confirm. Position updates are processed on SDK 50, but not on 51.
Regarding the new architecture: The documentation suggests that the expo-location is not supported, so I'm not using it ofc: https://docs.expo.dev/guides/new-architecture/#troubleshooting

@behenate behenate added Issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels May 20, 2024
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@tknuts
Copy link

tknuts commented May 20, 2024

Prioritize based on severity :-) All Android devices on SDK 51, can't use Location services.

@behenate
Copy link
Member

@tknuts It's a major issue, we'll resolve it asap 🫡

@managervcf
Copy link

+1

@behenate
Copy link
Member

Issue fixed in the PR above, after we merge it will be published under SDK 51 in a few days (probably sometime after App.js)

behenate added a commit that referenced this issue May 22, 2024
… the JS side (#29024)

# Why

Location updates wouldn't get passed to the JS side. Turns out the
TaskManager is still using the old EventEmitter which doesn't work in
SDK51 on Android

fixes #28959
fixes #29021

# How

Used a similar workaround to use the new EventEmitter as in `expo-av`
and `expo-battery`

# Test Plan

Tested in BareExpo on Android 14 emulator
behenate added a commit that referenced this issue May 28, 2024
… the JS side (#29024)

# Why

Location updates wouldn't get passed to the JS side. Turns out the
TaskManager is still using the old EventEmitter which doesn't work in
SDK51 on Android

fixes #28959
fixes #29021

# How

Used a similar workaround to use the new EventEmitter as in `expo-av`
and `expo-battery`

# Test Plan

Tested in BareExpo on Android 14 emulator

(cherry picked from commit 5e2fd74)
antwanvdm added a commit to antwanvdm/pokemon-gallery-react-native that referenced this issue May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants