Is there a way to check if android SQLite DB has been changed in anyway?
too be used in this sort of format:
i.e
if (isChanged){
POST data
}else{
Log.i("no changes")
}
Thanks
Is there a way to check if android SQLite DB has been changed in anyway?
too be used in this sort of format:
i.e
if (isChanged){
POST data
}else{
Log.i("no changes")
}
Thanks
An easy solution: you can create a windows service or just publish a .xml file containig a checksum <checksum>3203025</checksum>
http://prueba.agenciareforma.com/appiphone/android/checksumdb.xml
<?xml version="1.0" encoding="UTF-8"?>
<mobiledb>
<nombre>Stiri IASI</nombre>
<urlDB>http://jorgesys.com/appiphone/android/stiridb.db</urlDB>
<checksum>3203025</checksum>
</mobiledb>
checksum changes when changes into the db have been applied http://jorgesys.com/appiphone/android/stiridb.db
has changed.
Then check if the actual checksum is different to the last, so download the db with the new changes.
an example:
//method readUrlDatabaseChecksum(), download and parse the currently value of checksum from the .xml file
String checksumDB = readUrlDatabaseChecksum();
//method readDBChecksum(), get the stored value (preferences or db) of the las checksum.
String lastDBChecksum = readDBChecksum(); //dbm.obtenerCheckSum(seccion.getId());;
//If the values are different proceed to download the new version of the Database.
if(!checksumFeed.equals(checksumDB)){
Log.i(TAG, "*** Downloading new Database!");
//method downloadDatabase(), download the new version of the database.
downloadDatabase();
//method saveDBChecksum(), save the new value (preferences or db) of the las checksum.
saveDBChecksum();
}else{
Log.i(TAG, "*** Database hasn´t changed!");
}
I didn't find any API for that yet, but another option would be get MD5 value of sqlite file and compare with last MD5.