Kobe-Wan Kenobi
Kobe-Wan Kenobi

Reputation: 3864

Have data fixed or fetch for it Android

I am interested what approach to choose in situation if you have a client/server application in which you have some categories (just a type name - like coffee shop, restaurant, etc. and an icon for it), that you may want to expand in future.

One way to do it, as I see it know, is to have a string list resource (xml) and appropriate icons on the client side (concretely Android client), and when you want to add new categories, you will have to build new version and deploy it (if I'm not wrong and it all gets to binary for when compiled).

The other way is to have the type list on the server (let's say as a simple entity with type and icon), and that you're client fetches for it whenever is needed, per example, first fetch all the category names, and then the appropriate icon for selected.

So I'm interested in what is better in a situation like this?

Upvotes: 0

Views: 38

Answers (1)

Paresh Mayani
Paresh Mayani

Reputation: 128428

This is ultimately called Syncing functionality. It depends on the requirement and situations.

There are actually 3 ways to implement such functionality:

  1. Put all the required things inside the app and deploy onto the play store.
  2. Put static things inside the app(client) and dynamic changed values on the server.
  3. Put everything on server and sync into client as and when required.

Way 1:

In this way, you need to put everything into the app. Advantages of doing it are you would not have to depend on server and it loads faster. Disadvantage of doing is you would have to deploy app as and when data changes, even if you do a change in single value.

Way 2: In this way, you can keep static things like company logo, company banners and all such values which are usually don't change frequently. And you can store rest of the values which you think changes frequently like employee list/details.

So if there is new data available, client needs to be notified so that it can sync latest data into the local database.

Advantage of Way 2 is you wouldn't have to load static things again.

Way 3: In this way, everything is supposed to be on server, client has to sync data on first launch and then whenever new data is available.

Advantage of way 3 is you don't need to deploy app if any change in data values. But as this is depend highly on network connectivity/server, developer has to implement all the corner cases to avoid sync/data loss.

Upvotes: 2

Related Questions