Java – Archive of Android applications and (Android) libraries

Archive of Android applications and (Android) libraries… here is a solution to the problem.

Archive of Android applications and (Android) libraries

I’m designing an Android app and I have a few questions I’d like to hear from you.

Currently, the architecture that comes to mind is as follows:

  • Android applications for the user interface
  • Libraries for business logic (Android or “pure” Java?). ),
  • Android library for accessing the SQLLite database (to be used by business logic).
  • Android library for accessing the Wifi/BT module (will be used by the business logic).

Architecture quick schema

Since it is likely that a Java-based version of this Android application will be developed for Win/Mac/Linux in the near future, I have tried to separate the business logic from the Android-specific API.

Basically, the

business logic needs to use an embedded SQLite database as well as using a BT adapter and accessing the internet via Wifi, which can be done, for example, using two dedicated Android libraries. The problem is that I want the business logic to be just a “pure” Java library, not built on top of an Android project. Depending on whether this architecture is feasible, know that an Android application may have a configuration “module” that takes care of setting up and configuring and launching two Android-based libraries if needed.

Does the currently chosen architecture make sense to you?

What are your suggestions for the app:

  1. Be as modular as possible and have a good level of abstraction (on databases and BT/Wifi adapters).
  2. Keep the business logic as far away from the Android API as possible
  3. Only minimal changes are required to adapt the entire solution to classic Java applications.

Thank you in advance for taking the time to comment.

Solution

I asked a similar question – My goal is to develop an app for Android, Blackberry and possibly J2ME. I do this by implementing platform-specific components (UI, database access, network access) separately from the core business logic. Core BL was developed as a generic JAR library that I distribute to Android and BB apps.

While it worked, I wasn’t entirely happy with the solution. As I explained in answer here, (and even the answer to the first question I mentioned above), I had practical difficulties because BB/J2ME couldn’t keep up with the Java version. My Android implementation ended up using a lot of “legacy” code (e.g., no generics).

That being said, since your next goal is to use the desktop instead of BB or J2ME, you might not only be able to keep the design common between Android and desktop Java apps, but also share the implementation.

Regarding your question about abstraction, I recommend using interface-based business logic and database logic approaches. The link in the first paragraph of my answer above shows a simple example of how to achieve this, but I’m happy to provide more details.

Related Problems and Solutions