How often should Android applications and servers be synchronized
I’m working on an
Android app that talks to
a Play-framework app that uses
Volley to pass user data requests to each other, and my question is:
Is it advisable to have Android apps constantly synced with the Play server to check for changes to the user profile? (like synchronizing during fragment changes).
Or whether it’s better to have the user sign out on the Android app and sign back in before the change occurs.
Or are there some alternative solutions that only synchronize with the server when changes occur?
think the last option is the most efficient and ideal, but I don’t see how to check without sending a request to the server first, and it doesn’t make sense that I won’t make a change in the response if I send a request to check for changes.
You should not synchronize when the fragment changes. This is a waste of the user’s battery and data. You also most likely don’t want to force logout/login frequently, as this would be inconvenient for users.
If you want the user profile to change very infrequently, it’s a good idea to send a push request from the server using GCM to notify the application that it should invalidate its local cache. Then query the server for new profile information.
If for some reason you can’t use push, you might want to consider using SyncAdapter And not syncing often. In most cases, it should be fine if profile information is likely to lag, unless the user specifically checks the profile settings, in which case you may want to check the validity of the cache while they check their settings.