Question

I have to build an app that downloads its configuration (branding, menus, ...) at app start. I'll have several different activities, but the configuration needs to be available for every activity.

Question is: When do I download this configuration and how can I maintain a suitable lifecycle and access (for activities) to it?

Any best practices?

Was it helpful?

Solution

What we use to do in this case is -

  1. Download all Configuration while loading Splash Screen of app first time.
  2. And than can save all these in SQLiteDB or in SharedPreferences.
  3. After that, for each time app your runs, you must check for internet connectivity, IF is exists you SHOULD go for download configuration IF required for updates/modifications) OR you should fetch these from SQLiteDB/SharedPreferences.
  4. Now, you can access SQLiteDB/SharedPreferences from all your activities to use data.

Hope it helps, and let me know if yours use case is different..

OTHER TIPS

I recommend use a DB Sqlite with default settings for the user.

When the user install de app, you have the default configuration.

Later when the user need more specific things or customize something, you can bring the option to connect or select the options, and later save in the DB Sqlite.

If you always keep the data in DB Sqlite the user will be gratefull because you are thinking in his data plan.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top