如何检查来自亚行的shell共享preferences?shell、preferences

2023-09-05 07:12:56 作者:钟摆人.

现在,我们可以检查从远程Shell sqlite3的数据库,它是可能的检查从亚行的shell共享preferences?由于这将是更方便检查和命令行调试时,操纵共享preferences。

Now that we can Examining sqlite3 Databases from a Remote Shell, is it possible to examine SharedPreferences from adb shell? Since it would be much more convenient to examine and manipulate SharedPreferences from command line when debugging.

或者换用另一种方式,在什么文件共享preferences保存,以及如何查看和修改这些文件?

Or put in another way, in what files SharedPreferences are saved, and how to view and modify these files?

推荐答案

好吧,我发现就在我上面提出的问题的文件。 (这似乎发问公开刺激我由我自己更努力地寻求答案,因为我不希望我的亲爱的同龄人把我看成一个懒惰的程序员。)

Fine, I found the file just after I raised the question above. (It seem asking questions publicly stimulate me to search answers by myself much more diligently, since I don't want my dear peers to view me as a lazy programmer.)

这是在 /data/data/your.app.package.name/shared_$p$pfs 一个XML文件,文件名是your.app。 package.name_ preferences.xml。这是很容易,当你弄清楚,内容只是一个键 - 值映射修改preferences。

It is an XML file under /data/data/your.app.package.name/shared_prefs, and the file name is your.app.package.name_preferences.xml. It is really easy to modify the preferences when you figure out that the content is just a key-value map.