-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[sensors][iOS] Fix pedometer sensors when app goes to background then foreground #29957
[sensors][iOS] Fix pedometer sensors when app goes to background then foreground #29957
Conversation
…comes back active
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Thanks for your contribution!
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines. I've found some issues in your pull request that should be addressed (click on them for more details) 👇
|
@@ -13,6 +13,7 @@ | |||
- Fix incorrect event emitting tests. ([#28953](https://github.com/expo/expo/pull/28953) by [@aleqsio](https://github.com/aleqsio)) | |||
- Removed redundant usage of `EventEmitter` instance. ([#28946](https://github.com/expo/expo/pull/28946) by [@tsapeta](https://github.com/tsapeta)) | |||
- [Android] Remove usage of deprecated internal modules API. ([#28715](https://github.com/expo/expo/pull/28715) by [@lukmccall](https://github.com/lukmccall)) | |||
- [iOS] Fix pedometer sensor when app goes to background then foreground. ([#29957]https://github.com/expo/expo/pull/29957) by [@rlods](https://github.com/rlods)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [iOS] Fix pedometer sensor when app goes to background then foreground. ([#29957]https://github.com/expo/expo/pull/29957) by [@rlods](https://github.com/rlods)) | |
- [iOS] Fix pedometer sensor when app goes to background then foreground. ([#29957]https://github.com/expo/expo/pull/29957) by [@rlods](https://github.com/rlods)) ([#29957](https://github.com/expo/expo/pull/29957) by [@rlods](https://github.com/rlods)) |
Why
On iOS, Pedometer sensor is currently broken if app goes to background then comes back in foreground.
It's very easy to reproduce:
Pedometer.watchStepCount
Pedometer.watchStepCount
is subscribed againHow
The issue is that sensor reference values
watchStartDate
andwatchHandler
are reset in stopUpdatesWhile they should only be reset in
OnStopObserving
, which is also cleaner since both values are set in the opposite functionOnStartObserving
Test Plan
Manually tested
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).