views:

62

answers:

1

In one android application, I created a database file in data/data/com.rams/databases/dbfilename.

If I created a second application with the same package name (com.rams) and I access the database file created with my first application, the second application is able to access the database contents.

How can I secure the database file created with my first application?

+2  A: 

Almost without exception, and regardless of language or platform, there will always be a way for an application running with the relevant credentials, an application running within a certain environment or a user with the relevant credentials to access and read a given file.

You should assume it will always be possible to access a given file in ways you never intended.

Instead of trying to manage access to the file, try to manage comprehension of the file contents. In other words, it won't matter if everything and everyone can access and read a file if the contents are protected such that only an allowed application can understand the contents.

Or, more simply, look into encrypting the file contents if you need to absolutely ensure that nothing other than allowed applications can make sense of what is in a given file.

Jon Cram
Encryption is 1 way.There is no more alternative method?..
arams