-
Notifications
You must be signed in to change notification settings - Fork 28
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
pause stream vs cancel stream #114
Comments
When I change onResume from BufferingPeriodicStreamProbe , only the measurements during the duration, no matter the frequency, are saved and written down. I cancel the stream and reopen it again according to the frequency (instead of pausing):
This seems to work fine on my Android. If you think this is a good idea, I can also make an optional bool in PeriodicMeasure where you can choose to cancel/pause? I might however be missing the point of pausing instead of cancelling :). There might be other reasons to pause instead of cancel the stream of which I am not aware. |
I think you're right. The idea is that data sampling should not happen when the probe is paused. Hence, it seems like canceling (rather than pausing) is the correct way. I will look into changing this. But need to make sure that there are no side-effect. Making the optional bool don't seems to be a good idea, though. This would be difficult for the app developer to know which to choose. |
Looked into this, and you're absolutely right -- it keeps buffering event even when paused. This is now fixed as part of version |
Version 0.10.0 now released. |
When I use the accelerometer in the mobile sensing package, and I use a frequency of 20 vs 10:
vs
I get, in the end, the same amount of measurements (on my Iphone XS iOS 13.4.1 , the first writes 1000 every 10 seconds, the second writes 2000 every 20 seconds). This is because the stream is paused during the 10 (or 20) seconds. When the stream is resumed, everything that was in the stream is written in the json file. So in the background, the phone is still sampling constantly, and outputting the result to the stream.
First of all, this leads to a massive amount of data, and an explosion of the json file. Second, I guess (I am not sure though), this also drains battery faster.
In the flutter documentation you can read in the pause documentation:
Also, maybe related, in the creating streams documentation, you can find:
`
The text was updated successfully, but these errors were encountered: