In AndroidManifest.xml
, it's possible to define multiple <activity-alias>
elements. However, the ActivityAlias
java class does not suggest that these aliases can be defined at runtime.
Is it possible to add new activity aliases to an app at runtime?
From the clarification you gave in the comments, it appears that you don't actually want or need to define these aliases at runtime.
What you actually want to do is define lots of aliases (each with their own icon and text), but only have one of them active at once. When a particular user runs your app, you identify which branding they are associated with, and make just that alias active, via PackageManager.setComponentEnabledSetting. You may hit problems with some launchers that cache icons, and can get confused when the enabled activities for an app change, but any problems will just be shortlived, and generally go away next time the phone is powercycled (and thus the launcher app is restarted).
If you want to add another brand to your app, then you need to release a new version to the store with another alias in it, but that's fine, since all the users for the new brand will be coming to the app for the first time, and thus have to go to the store to install the app anyway.