carp-dk / carp-dk/flutter-plugins
[Pedometer 4.0.1 ] Unable to trigger listen practice when screen_off
- Dominant language
- Dart
- Stars
- 608
- Forks
- 735
- Avg merge
- 1m
- Merged PRs (30d)
- 3
Description
Please complete the following information for each phone and/or emulator you're experiencing this bug on:
- Device: Huawei P40 Pro
- OS: HarmonyOS 3.0.0 [compileSdkVersion 33]
### Describe the bug
Listen is often triggered when screen_on and I can get the number of steps. But once screen_off is no longer triggered.
### To Reproduce
Observe the printed event.steps.
```
void initPlatformState() async {
if (!await Permission.activityRecognition.request().isGranted) {
return;
}
_stepCountStream = Pedometer.stepCountStream;
_stepCountStream.listen(onStepCount).onError(onStepCountError);
if (!mounted) return;
}
onStepCount(StepCount event) {
print(event.steps);
sLogic.updateStep(event.steps);
}
```
### Expected behavior
I hope it can also be triggered in the screen_off state. Apps for obtaining step counts generally need to run in the background and be in the screenoff state.
### Actual behavior
What did happen? Include stack traces and exception print-outs.
### Flutter doctor
```
$ flutter doctor [10:08:20]
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel [user-branch], 3.13.9, on macOS 12.5 21G72 darwin-x64, locale zh-Hans-CN)
! Flutter version 3.13.9 on channel [user-branch] at /Users/knight0zh/software/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.85.1)
[✓] Connected device (4 available)
[✓] Network resources
! Doctor found issues in 1 category.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.