Do you know any ways to protect a database in Android?
I would like to implement the following, but don't know whether it is possible:
Tests with sqlite3 showed that you can change the database while another application uses it. So, I assume that possibly some external application can corrupt your data or use it, which is bad.
Also, how do you propose to process a database exception that could occur during such simultaneous database usage:
After all this happens, how do you propose to launch application next time?
Thanks
The android system automatically implements and enforces option (1) from your list. Every application on the phone/system has its own user ID, and no application can access the database files of any other application.
If you do want to share your data (with access controls), you can create a content provider, which can then be used by other applications: http://developer.android.com/intl/de/reference/android/content/ContentProvider.html
There are a couple of exceptions to the rules above:
Basically, you don't need to worry about it. Android will normally prevent these issues for you.
You should actually worry a lot. Is very easy to get your database and even code without rooting the phone. Here is an example of how to do it:
Now you have everything, code, database, images, xml files, everything!
So I can tell you you can have others people code and database in a few minutes. To protect your application use ProGuard, and use some type of encryption for your database. Personally I encrypt each field data and decrypt it at run time, with simple encryptions as XOR it doesn't really put much performance penalty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With