tags:

views:

71

answers:

2

I have a main application, and a bunch of sub-applications (they are separate apps, which do not appear on the android home dashboard). I was planning on having a SQLite DB which the main app maintains, and get a list of available sub-apps from. Is there a way to update this main database as the user installs the sub-apps?

Two alternative I was thinking of include:

  1. User installs the sub-apps via the main app, which would then update the DB.

  2. Rather than use the DB to find all installed sub-apps, have each sub-app declare a category, and use intents to query for all applications which match that query (is this even possible? if so, advice is welcomed).

Thanks!

A: 

Without knowing if android offers some hook or something, one solution would be to simply check the database for compatibility when the application starts and do the update then if necessary.

poke
+3  A: 

Check out SQLiteOpenHelper

A helper class to manage database creation and version management. You create a subclass implementing onCreate(SQLiteDatabase), onUpgrade(SQLiteDatabase, int, int) and optionally onOpen(SQLiteDatabase), and this class takes care of opening the database if it exists, creating it if it does not, and upgrading it as necessary. Transactions are used to make sure the database is always in a sensible state.

mbaird