Benny Margalit
Benny Margalit

Reputation: 233

Dynamic screens in Android application

i am programming an android application which can be use by different business and/or users, each can have its own configuration.

each business will set his required configuration (screens, text, and so) in a back office site (data will be saved in database).

on Splash screen i will fetch a Json string from the server which contain this business specific configuration. from now on the application should work base on this json.

my questions:

  1. is it recommended to build it this way?
  2. is it good practice to have a workflow manager class that will take care of screens transitions.
  3. can you please recommend a strategy you would go with.

here is a function that handle screen transitions

public static void startNext(String FromActivity, Context context)
{
    try
    {
        Intent intent = new Intent(context, Class.forName(context.getPackageName() + getNextActivity(FromActivity)));
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
    catch (ClassNotFoundException ex)
    {
        Log.e("test", ex.getMessage());
    }
}

the getNextActivity function return a class that should be open next based on the json string. and example of call from activity 1 to move to next activity

FlowManager.startNext(this.getLocalClassName(),getApplicationContext());

Upvotes: 1

Views: 151

Answers (1)

Bojan Kseneman
Bojan Kseneman

Reputation: 15668

When you have a customization like that it is best to make a build script which will download the latest code for a specific publisher from github/svn or something like that. It should also download publisher specific strings, launcher icons, name of the app and the end package package name, version, certificate to sign the application with, assets, rename all occurrences of default package... Make sure you exclude any unnecessary libraries that some publishers don't need and comment out the stuff related to that library. You can define start/end tags in code and then search for the start tag, replace it with /* and then replace the end tag with */ effectively commenting everything between them out. At the end the script runs gradle wrapper. First run clean and then build. It's also good to define the end output location of apk so it's easier to find.

The most easy way to build a build script like that is using bash scripts. They run on linux/mac or even both if you do it the right way. The whole think should run on a build server like Jenkins

After the build is done, it is good to upload the final *.apk to a server where publishers can download the latest apk and then upload it to Google Play Store.

Happy Coding!

Upvotes: 1

Related Questions