We know that in Android, the easiest way to save simple data is to use sharedpreferences, however, although sharedpreferences can be set up to share data between processes, it is not reliable (and, more deadly, Different levels of application cannot be shared using sharedpreferences, for example, a normal app cannot read sharedpreferences data from a system application.
How is it possible to share data across processes with simple data, and Settings.system can easily share it across processes, and it's simple to use:
Adding custom data to the System configuration table
Settings.System.putInt (Context.getcontentresolver (), "Ipcsharedtest", 100);
Other applications read the System Configuration Table "Ipcsharedtest" key value data
Settings.System.getInt (Context.getcontentresolver (), "ipcsharedtest");
As can be seen from the above method, its configuration/fetch data are obtained from ContentProvider, and ContentProvider is natural thread-safe, so use the above method to share data between different processes, without regard to thread synchronization issues.
This article is from the "whatever957" blog, make sure to keep this source http://whatever957.blog.51cto.com/6835003/1858282
Share simple data between Android processes