I\'ve defined an instance of SharedPreferences
that used on multi-process mode.
public class Prefs {
private static SharedPreferences pref
I've worked around this by combining:
SharedPreferences
file (such as by using a socket-based locking mechanism)SharedPreferences
with the MODE_MULTI_PROCESS
flag every time you want to use it to bypass in-memory cachingThis seems to work OK, but it hasn't been thoroughly tested in the real world, so I don't know if it's perfectly reliable.
You can see a working example I wrote here.
Warning: Looks like MODE_MULTI_PROCESS
has been deprecated in Android M. It might stop working in the future.