문제

I have a small app for lawyers that is working fine. But now I want to implement some courthouse data integration (in Brazil).

Unfortunatelly our courthouses doesnt provide any kind of API, so I need to perform some page crawling to obtain the information.

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. Doing this way I can publish updates more easily if one courthouse changes the site layout, without affecting other users.

i.e. the user download the main program (same for all users). The user from "Rio de Janeiro" downloads the crawler for "Rio de Janeiro" only, so does the user from "Sao Paulo" downloading only the "Sao Paulo" crawler.

In a windows development platform I would develop some DLLs and the work is done, but I dont know exactly how to do this in Android. I understand that I will need to develop a differente "app" for each State, but how can I check which modules are installed and most important how to call the modules functions?

So I need some basic guidance on how to do a module development and integration with main app.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top