Author Topic: How i can prevent database in android app from being copied.  (Read 751 times)

0 Members and 1 Guest are viewing this topic.

Offline blackwidow95

  • NULL
  • Posts: 1
  • Cookies: -1
    • View Profile
How i can prevent database in android app from being copied.
« on: December 30, 2014, 04:35:19 pm »
Hey guyz I am going to have an Android application with a SQLite database with some unique data which I don't want people to copy. What are the options to hide it, to prevent it being copied by hackerz ?

Offline z3ro

  • Knight
  • **
  • Posts: 345
  • Cookies: 60
    • View Profile
Re: How i can prevent database in android app from being copied.
« Reply #1 on: December 30, 2014, 06:09:49 pm »
Non-rooted users shouldn't be able to access it.

* And consider encryption (won't prevent 'hackerz' from copying the database but will make it pretty useless to them)
SQLCipher (https://www.zetetic.net/sqlcipher/)

OR, glue the damn phone to your hand. Disable debugging.
« Last Edit: December 30, 2014, 06:10:44 pm by z3ro »
~ God is real. Unless declared as an integer.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: How i can prevent database in android app from being copied.
« Reply #2 on: December 30, 2014, 06:31:33 pm »
Tbh I was about to walk away from this, but I'll be a nice guy and contribute a bit even tho you sound like a child.

So short answer - you can't protect it from "hackerz". You probably don't even know how the whole thing works.
If you embed the DB with your app, the app can copy it to the data folder, where it will be only accessible by that application, or you can code your app to put it on the external memory. Either way, if the phone is rooted then anyone can access any app's data with something like "Root Explorer".
You can omit the database from the app when exporting and download it when the app runs for the first time, it'll require and internet, some users might not be happy, but this way the DB can't be grabbed just by unzipping the .apk file.
Best thing would be to have a web service backend that your app would run against to receive data, ofcourse that will require internet all the time, but that is the safest solution in this case (data can still be mapped and grabbed through API calls which can be discovered after undexing your code, but not whole, you'll have to think about some sort of a protection).

Then there's security through obscurity, which works in special cases, one being that data contained is not worth the time wasted decrypting the DB and reversing your code. You'll have to store the encryption key somewhere in the app anyway.

Overall, the only uncrackable software is open source.
« Last Edit: December 30, 2014, 06:34:03 pm by Kulverstukas »