Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为一个应用程序编写一个内容提供程序,该应用程序公开一些存储在应用程序共享首选项中的数据。有可能这样做吗?
你为什么要这样做?通常首选项是秘密数据,应该只对源应用程序可用。
如果您想这样做,您可以通过获取源应用程序的上下文来读取其他应用程序的偏好
Context otherAppsContext = createPackageContext("other.application.package", mode);
此外,您应该了解您无法获得所有偏好。当您收到结果时,您会看到 PRIVATE 和 WORLD_WRITABLE 不可用。