getodk / collect

ODK Collect is an Android app for filling out forms. It's been used to collect billions of data points in challenging environments around the world. Contribute and make the world a better place! ✨📋✨
https://docs.getodk.org/collect-intro
Other
700 stars 1.35k forks source link

Fix autosend scheduling #6121

Open seadowg opened 1 month ago

seadowg commented 1 month ago

Closes #6120

This also:

It's probably a good idea to wait on merging this until it's marked "behaviour verified" as we've seen a lot of churn on auto send recently.

Why is this the best possible solution? Were any other approaches considered?

I would have loved to have a more elegant solution for "cellular only", but couldn't find one that would work within the WorkManager world. I think the compromise of having other settings work optimally within Android's current background job setup is correct though.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

This should mean that auto send now behaves more like how we'd "expect". One caveat to highlight is that metered wifi (like a hotspot) will not work with "wifi only" or "cellular only". The work around for this (other than using "wifi or cellular") is to change the wifi to "unmetered" in Android's settings.

Before submitting this PR, please make sure you have:

seadowg commented 4 weeks ago

@WKobus could you take another look at this when you get a chance? The biggest change since you last looked is that "cellular only" shouldn't run when connected to a metered wifi (like a hotspot), but should run eventually if you then just connect to cellular (although it might take a few minutes).