Android: SharedPreferences not accessible from SyncAdapter

When I was trying to access a SharedPreferences value from my Android app’s SyncAdapter, I kept on receiving an old value that was saved to the key.

Quick solution to inaccessible SharedPreferences from SyncAdapter

A quick solution (which may be a short-term one) I tried was to remove android:process=":sync" from the following code:

But beware:

The attribute android:process=”:sync” tells the system to run the Service in a global shared process named sync. If you have multiple sync adapters in your app they can share this process, which reduces overhead.

My long-term solution to inaccessible SharedPreferences from SyncAdapter

Source:
SharedPreference committed in SyncAdapter not updated in Activity?

Related Posts:

Posts that may be related to "Android: SharedPreferences not accessible from SyncAdapter":

Catzie

A Filipino programmer with a variety of interests such as baking, singing, making up silly song/rap lyrics, K-pop, drawing, creating unique dessert flavors, obsessing about finding out how some things works, board games, anime, video games, and forgetting things that usually go in her long list of interests. Running small-time online dessert shops Cookies PH and Catzie's Cakery.

Leave a Reply

Your email address will not be published. Required fields are marked *