6-10. Sharing Your SharedPreferences
Problem
You would like your application to provide the settings values it has stored in SharedPreferences to other applications of the system and even to allow those applications to modify those settings if they have permission to do so.
Solution
(API Level 1)
Create a ContentProvider to interface your application’s SharedPreferences to the rest of the system. The settings data will be delivered using a MatrixCursor, which is an implementation that can be used for data that does not reside in a database. The ContentProvider will be protected by separate permissions to read/write the data within so that only permitted applications will have access.
How It Works
To properly demonstrate the permissions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access