We have an Android app, which is using read/ write data using Android Room database library, and then download/ upload to cloud storage.
Now, we are developing an iOS app, which is suppose able to read/ write the data.
There is no issue for our iOS app to read SQLite file written by Android Room database, because we are the one who define database schema.
However, there are issue, for iOS app to write an Android Room database library compatible SQLite file. We notice Android Room database library is expecting the following 3 additional tables.
CREATE TABLE room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT);
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE sqlite_sequence(name,seq);
The sample data contain in the 3 additional tables are as follow.
INSERT INTO "main"."room_master_table" ("id", "identity_hash") VALUES ('42', '5471e2f102feee2750d42986836b0c42');
INSERT INTO "main"."android_metadata" ("locale") VALUES ('en_US');
INSERT INTO "main"."sqlite_sequence" ("name", "seq") VALUES ('plain_note', '62');
INSERT INTO "main"."sqlite_sequence" ("name", "seq") VALUES ('attachment', '6');
INSERT INTO "main"."sqlite_sequence" ("name", "seq") VALUES ('tab_info', '5');
I think I am able to generate data for android_metadata
& sqlite_sequence
manually.
But, I am clueless in generating data for room_master_table
.
I tested a SQLite file without room_master_table
, it will cause the following error during reading via Android Room.
Caused by: java.lang.IllegalStateException: Room cannot verify the data integrity. Looks like you've changed schema but forgot to update the version number. You can simply fix this by increasing the version number.
I was wondering, is there a way to generate SQLite file from iOS platform, which is compatible with Android Room database library? Or, it is simply not possible?