开发者

Is there a way to update a database when installing/upgrading an app?

I ha开发者_运维问答ve 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜