I am working on designing an Android application, and I have several questions I would like to have your opinion on.
Right now, the architecture I am thinking of is the following:
- Android application for the User Interface,
- Library (Android or “purely” Java?) for the Business Logic,
- Android Library for accessing SQLLite Databases (will be used by the Business Logic),
- Android Library for accessing Wifi/BT modules (will be used by the Business Logic).

Since it is very likely that in a close future a Java based version of this Android application might be developed for Win/Mac/Linux, I am trying to keep the Business Logic as much apart from Android specific APIs.
Basically, the Business Logic will need to use the embedded SQLite DB as well as use the BT adapter and access the Internet through Wifi for example, this could be done using the two dedicated Android Library. The issue is that I would like the Business Logic to be only a “pure” Java library, and not built upon an Android project. Is that feasible according to this architecture, knowing that is is possible the Android Application will have a configuration “module” in charge to setup and configure and initiate if needed the two Android based libraries.
Does the currently chosen architecture make sense in your eyes ?
What could be your advice for this application to:
- Be as modular as possible with good abstraction level (on DB and BT/Wifi adapter),
- Keep the Business Logic as much as possible clear from Android APIs,
- Require minimal changes to adapt this whole solution for a classical Java application.
Thank you in advance for your time and opinions.
I had asked a similar question – I was aiming to develop an app for Android, Blackberry and possibly J2ME. I did this by implementing platform-specific components (UI, DB access, Network access) separately from core business logic. The core BL was developed as a common JAR library that I distributed to Android and BB apps.
Although it worked, I was not really satisfied with the solution. As I explained in an answer here, (and as even the answers to my first question above mentioned), I faced practical difficulties since BB/J2ME have not kept up with Java releases. My Android implementation ended up using a lot of “legacy” code (no generics, for example).
Having said that, since your next aim is to go desktop rather than BB or J2ME, you might be able to not only keep your design between your Android and desktop Java apps common, but also share the implementations.
Regarding your question about abstraction, I would suggest an Interface-based Business Logic and DB Logic approach. The link in the first para of my answer above shows a simple example of how to achieve this, but I would be glad to provide more details.