I'm working on a small fitness app in which the user (whom is authenticated with the a server) could create their own workout plan which will be synced with a server.
The problem with this is that What if the user has installed the app on multiple devices then he edited a workout plan's title on device A when it was offline and then he edited the title of the same workout plan again on device B which was online so it synced with server. Then the user went online on device A which would then automatically sync with the server. This would mean the previous title will be synced with the server an user.
The user is authenticated with google sign in/fb sign in using their official sdks.
During Authenticating the following data is added to server: Id, name, gender, email, age, weight, height, followers, following, platform.
All the data including the user data is stored on a mysql database
All the data from the server is accessed using php
The user data on the android device is stored in Shared Preferences and the user Workout Plans data is stored in SQLite Database.
My question is, How do I normally sync the data of the same user Across multiple devices.. I already got an idea of how I might do this but I know that loots of apps before mine has come to the same problem and there might a normal/standard way of doing this? Thanks :)