Android系统。如何保护你的数据库? [英] Android. How to protect your database?
问题描述
你知道什么方法来保护数据库中的Android?
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:
- 限制访问数据库只应用程序所有者(这创造和提供的话)。
- 在限制或DB所有者应用程序的使用会议期间拒绝来自所有其他应用程序对数据库的访问。
- 有什么方法来设置密码保护你的数据库?
与sqlite3的试验表明,你可以在其他应用程序使用它更改数据库。所以,我认为可能是一些外部应用程序能够破坏你的数据,或者使用它,这是坏的。
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?
感谢
推荐答案
Android系统自动执行和(1)从列表中选择强制执行。手机/系统上的每个应用程序都有自己的用户ID,没有应用程序可以访问任何其他应用程序的数据库文件。
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.
如果你想(访问控制)共享您的数据,您可以创建一个内容提供者,然后可以使用其他应用程序:的http://developer.android.com/intl/de/reference/android/content/ContentProvider.html
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:
- 在在SDK模拟器中,亚行外壳让你完全进入模拟手机的文件系统。这不是一个活的android手机的情况。
- 在一个电话,一直以根,是可以获得根权限就可以访问任何其他应用程序的数据库文件(以及任何其他)任何应用程序 - 这是生根您的手机的成本/风险,并该设备拥有者的责任。
基本上,你不必担心。 Android将正常prevent这些问题给你。
Basically, you don't need to worry about it. Android will normally prevent these issues for you.
这篇关于Android系统。如何保护你的数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!