如何打开系统SQLiteDatabase [英] How to open system SQLiteDatabase

查看:90
本文介绍了如何打开系统SQLiteDatabase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开SMS数据库(对于检查员应用程序)与此code:

I'm trying to open the SMS db (for censor app) with this code:

SQLiteDatabase db = SQLiteDatabase.openDatabase("/data/data/com.android.providers.telephony/databases/mmssms.db", null, SQLiteDatabase.OPEN_READWRITE);

但它引发异常:

11-02 18:18:50.889:E / AndroidRuntime(17226):产生的原因:
  android.database.sqlite.SQLiteException:无法打开数据库文件

11-02 18:18:50.889: E/AndroidRuntime(17226): Caused by: android.database.sqlite.SQLiteException: unable to open database file

我可以从亚行外壳打开它。
是否有可能打开这个分贝RW?或者,也许这是可能只有当我有root权限?

I can open it from the ADB shell. Is it possible to open this db for rw? Or maybe it's possible only if I have root permissions?

推荐答案

您不能,除非你的code与超级用户访问运行打开别人的数据库。许多应用程序提供 内容提供商允许限制访问他们的从code数据。

You can't open someone else's database unless your code is running with superuser access. Content Providers are offered by many applications to allow restricted access to their data from your code.

这篇关于如何打开系统SQLiteDatabase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆