One code base, different apps

Hi there,

I am pretty new to the App world and I’d like to know whether it is possible (and how) to use one code base for different apps. The reason behind this is that the customer needs different apps, all working pretty much the same, with different icons, splash screens and maybe little color changes (i.e. different CSS).

What’s the best way to do this?

The only thing that comes to my mind is to create one “main application” and then create different copies of it and change the icons and splash screens manually. Then submit all apps independently to the app stores. But that will be very difficult to maintain.

Thanks in advance.

1 Like

I think it is possible. But you need to change the application Id in config.xml. I have been building same thing for different clients but with same codebase.

So what did you do exactly? Did you use different folders?

Yes, used copy of same codebase and changed the themes and other configuration.

One important thing is for Android is you need to change the following widget ID

<widget id="" version="0.0.1" xmlns="" xmlns:cdv="">
while uploading the Google play store.

Thanks! But maybe someone has an even better approach with no redundant copies?

Basically, you need to create gulp tasks to automate the different build processes.

The gulp-xml-editor node module can help you automating the changes needed in the config.xml files before running the “ionic build xxxx” commands.

I had the same challenge, I had to develop 2 related apps, a “consumer” app and a “business” app for the same client. The apps need to communicate between them (so a consumer can communicate with a business using the app).

The apps are something like 60% to 80% “different” and 20% to 40% “the same” (rough guess).

The looks (UI, CSS) and some of the functionality (services, directives) are the same but a lot of the business logic is different.

The approach I ended up with is to have 2 separate Ionic apps (in 2 directories) and a set of “common” services and directives that I share between the 2 apps.

I then simply use symlinks (symbolic links, created with the “ln -s” command) to “link” these shared components into each app. I also adapted my “gulp” tasks to include the shared resources in my production builds.

This is a fairly low-tech approach but it worked well for me and removes much of the need for duplication and “copy/paste”.

Thanks for all your help. I have never worked with gulp tasks. Any recommended reading stuff or can you share your gulp tasks?