Say, I have a well-built room database in my app.
I planned to do a upgrade for the database. However, the upgrade / data migration is huge, thus I'd like to tell user to be patient, by displaying UI message, such as a AlertDialog or Toast, etc.
But I don't know how to check if message is needed to play ---- I mean, how do I get / check their present database version? Is there any function that works like RoomDatabase.getVersion(), or RoomDatabase.isOlderVersion() / RoomDatabase.isOutDated() ?
On the other hand, I know there's Migration class. Considering it was all I know that can check database version, I was planning to do like
- Create Listener Holder in the Database.
- Before UI Thread build the Database, register a listener in it.
- When
Migrationis called, notify the listener to do things.
However, isn't it to complicated for a version upgrade? Any better idea?