I am developing a app using android C2DM. sqlite3 is my back-end. Everything is just working fine but am struck with an performance issue regarding sqlite3. so my question is 'can i place the database code somewhere where it will be executed only once i.e The dvm(dalvik vertiual machine) should execute the code pertaining to the db only once; during the successive run the dvm should not go thru the (db)code because the db had been created.
More specifically, my app send msg to all the phones which has my app. so when an app at the client end receives a msg, the dvm should not execute this code : SQLiteDatabase db;
//use tat ref to open or create a table
db = openOrCreateDatabase( "/data/data/de.vogella.android.c2dm.simpleclient/app_database/file__0/0000000000000001.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
try
{
//initialsiging a query with all the table fields
final String CREATE_TABLE_CONTAIN = "CREATE TABLE IF NOT EXISTS tbl_Message4("
+ "id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "msg TEXT not null,"
+ "msg_time INTEGER not null,"
+ "msg_status INTEGER not null);";
//execute the above query
db.execSQL(CREATE_TABLE_CONTAIN);
Because everytime a msg comes this code ll be executed. So i want to avoid this, i guess i hv conveyed my message. Any help ll be much appreciated.
Thanks,
TheIlliterate