Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to achieve modularity structure of app subcomponents on Android?

My Android main application will consist in a main program, with a few pre-installed modules.
Then I want to offer different modules later, best would be as separate files. Modules like: location, weather, agenda.

How would you accomplish this?

I want to keep in the database the modules that are installed/present. So I must put sometimes the modules into database, maybe by detecting if there are present at launch time. The main app will work based on these modules.

How can I build these modules as separate files? They won't be an entry point in my application. So they must not be an application in the navigation menu.

Is this possible?
How do I have to create this using Eclipse?
In what format will I offer the modules?
How will the user add/remove modules?

like image 437
Pentium10 Avatar asked Feb 09 '10 20:02

Pentium10


People also ask

Why use multi module Android?

In addition to the build speed, multi-modularity also leads to a stricter architecture and the ability to reuse features among projects. It is also worth remembering that multi-modularity is not a silver bullet and it can have negative consequences, with increased project configuration time among these.

What is app module in Android?

Android Studio offers a few distinct types of module: Android app module. Provides a container for your app's source code, resource files, and app level settings such as the module-level build file and Android Manifest file. When you create a new project, the default module name is "app".

How many modules in Android?

There are three essential types of modules that Android studio supports: App modules are an entry point to your application. They can contain source code, resources, assets and an AndroidManifest. xml .


1 Answers

Android allows you to loosely couple applications together with Intents and ContentProviders, so it should be possible to achieve what you're looking for. The hard part will be planning everything up front, so you have logical divisions of functionality (and so things plug together easily).

I want to keep in the database the modules that are installed/present. So I must put sometimes the modules into database, maybe by detecting if there are present at launch time. The main app will work based on these modules.

You can register a BroadcastReceiver for ACTION_PACKAGE_ADDED, which will fire whenever a new application is installed. Your main application should be able to use this to determine when additional modules are installed.

In what format will I offer the modules?

You probably want to still package the modules as apks so they can be uploaded to the marketplace. If you want them to not appear in the launcher (the app drawer), you can always remove the default <intent-filter> and the app will not be launchable (but still be removable).

How do I have to create this using Eclipse?

Your modules would still be standalone applications.

How will the user add/remove modules?

From the marketplace or direct downloads off of the web (if you want).

like image 51
Erich Douglass Avatar answered Sep 23 '22 05:09

Erich Douglass