1 year ago
#367828
Claude Hasler
when to synch with backend from mobile app
Im getting into mobile development and have some questions regarding when to best communicate local changes to the backend.
1)User manipulates local data. User persists data to backend by explicitly by pressing "save". User sees a spinner. User receives a confirmation or error message. Checkbox example: User taps checkbox -> User taps save -> Succes or error message.
2)User manipulates local data. Data automatically begins to be persisted to backend. UI changes immediately to reflect changed data state. The user is only notified if the backend cannot be reached, and data/UI must be rolled back to original state, or inform user that the backend could not be reached.
3)User manipulates local data. Data is persisted to local storage immediately. Eventually consistent asynchronous process synchronises changed local data with backend. User may exit app before data synched with the backend leading to confusion.
Option 1 is simplest to implement and clearest for the user as the saving process is explicit. Checkbox example: Check -> uncheck -> check ->uncheck -> save -> 1 call to api
Option 2 is seamless for the user and UI is immediately consistent with backend data storage. May result in many calls to backend API, as every state change is sent. Checkbox example: Check -> api call -> uncheck -> api call
Option 3 is seamless for the user and UI is eventually consistent with backend data storage. User may receive late notification of failure making it difficult to show exactly what failed. Not every change results in an api call Checkbox example: Check -> uncheck -> check -> ...eventually 1 call to api
I'm not sure what style of persisting changes to the backend I should use. I tried searching for more information about the topic but may be missing the correct keywords. What are some common patterns used in mobile apps to solve this?
api
mobile
synchronization
backend
persistence
0 Answers
Your Answer