For each State I need to develop a different library, and I wish to develop separate modules so the users need to install only the modules for the State they work in.
That seems like serious overkill for a handful of states, each of which requiring a handful of lines of dedicated code.
how can I check which modules are installed
Use PackageManager
. For example, you could call getInstalledPackages()
and iterate over them looking for ones whose package name matches some pre-defined pattern (e.g., com.klamarth.brcourt.state.*
).
how to call the modules functions?
You don't. Your "modules" need to export some Android component (e.g., service), and your main app can then talk to that component. Which component (activity, service, content provider, or broadcast receiver) would be up to you, depending upon what the module is doing and how the user interacts with it.