Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to develop an app that has add-ons?

Tags:

android

Is there an outline or primer of how you would develop an app that has "add-ons"?

E.g., how to develop some sort of framework for adding "themes" to an app?

There is the basic app with 2 themes. The user should be able to download another app for a certain theme.

How does the original app and the new downloaded app talk together?

How would you develop the original app to get the theme information and graphic assets from the 2nd theme only app?

My understanding is that apps are completely separate so this is why I am unclear how to accomplish this.

like image 909
Camille Sévigny Avatar asked Jan 06 '12 18:01

Camille Sévigny


1 Answers

How does the original app and the new downloaded app talk together?

For a theme, who says they have to talk together?

How to would you develop the original app to get the theme information and graphic assets from the 2nd theme only app?

Step #1: Pick a naming convention for your packages. For example, if your base app is com.abc.app, your themes could be com.abc.app.theme.*.

Step #2: When it comes time for the user to pick a theme, use PackageManager and getInstalledApplications() to find your themes by checking their package names.

Step #3: When it comes time to use a theme, call getResourcesForApplication() on PackageManager to get the theme application's Resources, so you can get at your stuff.

I am sure that there are strategies (e.g., the theme is mostly a conveyor, deploying its stuff in a directory on external storage, from which your main app reads the information), but this is the one I'd start with, as it should require the least user intervention.

like image 112
CommonsWare Avatar answered Oct 27 '22 18:10

CommonsWare