-
Notifications
You must be signed in to change notification settings - Fork 34
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
app user obliged to force sync ? #686
Comments
@PatGendre this is probably because the background operations are not running properly. on android, the periodic hourly process is the one that pushes the data to the server. You want to search for
in the phone logs. If you don't see them multiple times a day, this is the problem. The workaround is to incorporate e-mission/e-mission-phone#797 while waiting for a principled fix from @ericafenyo |
Hi @shankari As far as I understand this PR cannot be merged (it has conflicts) but you expect @ericafenyo to write a similar PR which would force sync on trip end, which could fix the issue (as a workaround to some phones blocking the correct background operations). This would be great, we'll pull this fix in our tracemob app when it is available :-) |
@PatGendre the conflict is in recording the stat after the force sync; if you just change
But this assumes that the user does launch the app periodically. A more principled fix is to push the data at the end of the trip so the pushes can happen completely in the background. And @ericafenyo has graciously agreed to contribute that change! |
@shankari thanks again, no hurry, enjoy Thanksgiving !! |
Yea, I'm currently on vacation. I will start working on it after I am back. |
@shankari , @PatGendre |
I will illustrate what I did on our end. I am also open to any ideas for improvement. After the handleTripEnd() in the The broadcast: // TripDiaryStateMachineService.java#handleTripEnd()
// Force sync
ctxt.sendBroadcast(new ExplicitIntent(ctxt, getString(R.string.tracker_event_trip_ended))); The receiver: // SynchronizeDataReceiver.kt (BroadcastReceiver)
...
override fun onReceive(context: Context, intent: Intent?) {
Timber.d("onReceive(context: $context, intent: $intent)")
externalScope.launch(dispatcher) { syncData() }
}
private fun syncData() {
try {
dataSyncManager.forceSync(authenticatedUser.getIdToken())
} catch (exception: Exception) {
Timber.e(exception, "Error occurred while syncing data with server")
}
}
... The dataSyncManager:
Since we have a custom jwt_auth implementation, we injected the |
@shankari, @PatGendre
|
@ericafenyo the CI seems to be working, including the scheduled runs on master. Are you using the current setup requirements, including Java 1.8? |
@ericafenyo in terms of the overall design, this seems fine. I have generally been handling the state machine transitions in The general rule of thumb is that receivers are not supposed to perform intensive tasks, but are supposed to delegate to a service instead. (https://developer.android.com/guide/components/broadcasts).
I think that is what you are doing with
Can you tell me a little more about what |
This certainly looks like having to incorporate androidx support. I believe android10 now requires androidx support. But that was enabled back in 2020 (e-mission/e-mission-phone@5a832ca) for the phone repo... |
Yea, I am on 1.8. I will take a closer look at the CI and try again.
The I will not use
Okay |
I think that it could be a long-running task depending on network connectivity, etc. Have you not run into issues where the task is killed? You should be able to call you can invoke the background process from there - the current implementation uses several async |
@shankari @PatGendre My tests: https://drive.google.com/file/d/13aElKiX4gjr7ioIh6qWQ7RaOsTX0zsH2/view?usp=sharing |
@ericafenyo thanks for the manual testing. One of the goals of the additional funding from DOE is to introduce automated testing on the phone as well. |
hi @shankari , our project manager la Rochelle Romain is also a user of course, he is obliged to 'force sync' regularly on the app because otherwise the trips stay as draft so supposedly cannot make it to the server and get processed by the pipeline.
I couldn't find any error in the server logs and in his recent app log he sent me (the db file is 5MB so I cannot attach it), I don't see any communication error either, except maybe this "checkSelfPermission returned 0" ? (the other permission checks seem to return true, although I did not check systemically).
Where should I look for, otherwise ?
Thanks
The text was updated successfully, but these errors were encountered: