sqlite - 访问 Lollipop 上的启动器数据库

标签 sqlite android-sqlite android-5.0-lollipop android-contentprovider android-launcher

我正在尝试按照此方法Trying to access the LauncherProvider在运行Lollipop 5.1.1的Samsung设备上访问Launcher数据库:基本上,轮询PackageManager以获取已安装的软件包,然后遍历提供程序以查找具有READ_SETTINGS和WRITE_SETTINGS权限的提供程序。就我而言,findLauncherProviderAuthority返回

com.sec.android.app.launcher.settings

但是当我使用它来构建getContentResolver URI并打开游标以访问Launcher数据库收藏夹表时
我得到了


android.database.sqlite.SQLiteException:无此类列;


从投影字符串中删除有问题的列只会导致具有不同列名称的类似错误。
接下来,我检查了电话,并在“设置”->“ TouchWize Home的应用程序管理器”中找到了与权限相关的条目

com.sec.android.provider.badge.permission.READ和
com.sec.android.provider.badge.permission.WRITE。
弄清楚这与Samsung Launcher有关,我尝试使用这些权限,但现在光标值变为null。

任何提示和建议,不胜感激

最佳答案

我尝试将null投影传递给内容提供者,当您使光标返回时,遍历各列并获取名称。

 if (cursor != null) {
            int columnCount = cursor.getColumnCount();
            for (int i=0; i < columnCount; i++) {
                android.util.Log.e(TAG,"Column [" + i + "]: " + cursor.getColumnName(i));
            }
        }


然后,您可以看到数据库具有哪些列。也许它们具有前缀列。

关于sqlite - 访问 Lollipop 上的启动器数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35305837/

相关文章:

android - 使用 greenDao 动态查询

java - 如何在 Android 中自定义适配器?

android - sqlite数据库没有得到更新

android - 如何按desc顺序从sqlite中检索数据并在textview中显示

android - 如何在React原生sqlite数据库中使用upsert

android - 最新 Android L 版本中的 ActionBar 菜单主题问题

android - Ready XML 数据库或将其转换为 SQLite 哪个更好?我可以将转换后的 SQLite 数据库放在 package(.apk) 上吗?

java - "No Such Table"在 SQLite Android 中发现错误

android - 在 android 5 (api 21) 上设置 ImageView colorFilter

android - 使用 Android L 和 Camera2 API 处理相机预览图像数据