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

Call ForceSync on app resume #797

Open
wants to merge 1 commit into
base: single_tenant_app_snapshot_unmaintained
Choose a base branch
from

Conversation

shankari
Copy link
Contributor

This is a UI-only hack to experiment with syncing on every app start/resume.
In general, our assumption was that people will open the app only sporadically,
and we want to push data more frequently than that. So we do so in a background
process.

However, due to the various restrictions on background operations in android,
sometimes the background process is not launched. We can ask the user to "force
sync" but that is not a viable solution as well.

We push a UI-only update that force-syncs on every app launch to see the extent
of this problem and confirm that this fixes it.

Once we know that this works, we should move this to native code, potentially
by pushing data at the end of a trip as we do on iOS. We may also want to
introduce silent push notifications on android as well.

Testing done:

  • Started app
  • Paused and resumed app

Saw message "app has started/resumed, forcing sync on android" in the console
in both cases.

This is a UI-only hack to experiment with syncing on every app start/resume.
In general, our assumption was that people will open the app only sporadically,
and we want to push data more frequently than that. So we do so in a background
process.

However, due to the various restrictions on background operations in android,
sometimes the background process is not launched. We can ask the user to "force
sync" but that is not a viable solution as well.

We push a UI-only update that force-syncs on every app launch to see the extent
of this problem and confirm that this fixes it.

Once we know that this works, we should move this to native code, potentially
by pushing data at the end of a trip as we do on iOS. We may also want to
introduce silent push notifications on android as well.

Testing done:
- Started app
- Paused and resumed app

Saw message "app has started/resumed, forcing sync on android" in the console
in both cases.
@ericafenyo
Copy link
Contributor

I think this is very practical for trips that were not pushed early due to issues like internet connection, etc.
From our end, since most of our functionalities were based on analysed trips, we added the option to push data at each trip end. It has been working for us so far and the time it takes for the analysed trips to appear on the diary page now depends on the pipeline time and not the phone-server sync. (Which was the case)

@shankari
Copy link
Contributor Author

@ericafenyo if you could submit a PR to push the data at the end of the trip on android (IIRC, we already do this on iOS), I would be happy to merge it.

@ericafenyo
Copy link
Contributor

... if you could submit a PR to push the data at the end of the trip on android (IIRC, we already do this on iOS), I would be happy to merge it.

Sure, I will submit it once it is ready. Thanks :)

@shankari shankari changed the base branch from old_master to master June 15, 2022 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants