Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing android application in separate working modules

Tags:

android

I have seen applications with add-on modules on market - these modules add-up some new functionality. What would be the best way to do that ?

I cannot think of a descent and neat way to do that.

like image 713
stillLearning Avatar asked Jul 13 '11 02:07

stillLearning


People also ask

What are the modules in Android application?

Modules. A module is a collection of source files and build settings that allow you to divide your project into discrete units of functionality. Your project can have one or many modules, and one module may use another module as a dependency. You can independently build, test, and debug each module.

What is a multi module app Android?

A project with multiple Gradle modules is known as a multi-module project. In a multi-module project that ships as a single APK with no feature modules, it's common to have an app module that can depend on most modules of your project and a base or core module that the rest of the modules usually depend on.

What is modular programming in Android?

Modularization is a practice of organizing a codebase into loosely coupled and self contained parts. Each part is a module. Each module is independent and serves a clear purpose. By dividing a problem into smaller and easier to solve subproblems, you reduce the complexity of designing and maintaining a large system.

How many modules are there in Android Studio?

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.


2 Answers

There are many ways. The most common is to just install another application and access it via Intents. It's definitely worth looking at Open Intents. If you are really adventurous, you can even load custom plugins with DexClassLoader.

like image 195
Thomas Dignan Avatar answered Oct 10 '22 23:10

Thomas Dignan


IMHO the only way to cleanly implement this is to use Android's build-in extensibility, namely by using Intents and/or BroadcastReceivers. This is the way Android apps are supposed to communicate with each other, but it may work perfectly also for your own app by creating a main version which is extensible through Intents by your "plug-ins" which can be downloaded separately from the market.

The things you need to learn about and look for on the web to implement such functionality are

  • Intents: Learn how you can use intents to pass data from one app to another or to invoke certain functionality on other apps.
  • BroadcastReceiver: For listening to certain events broadcasted by your app in your "plug-ins"
  • ContentProvider: The content provider is used to provide an abstraction over your data and allows your "plug-ins" to access your app data easily and nicely decoupled through Content URIs.
  • Intent Filters: These are used to tell the system which kind of actions/Intents my specific Activity is able to accept. You will need them as a way for invoking your plug-ins (by broadcasting an Intent with the given action/category) as well as for providing a space in your menus where "compatible" Intents may hook in automatically.

I hope I was able to provide you some of the topics you need to know about. I'm sure that once you get a deeper understanding on these, you will get a much clearer picture on how to realize such a modular app.

like image 24
Juri Avatar answered Oct 11 '22 01:10

Juri