Hey folks, how are you doing? I'd like to know if ...
# android
c
Hey folks, how are you doing? I'd like to know if it's ok to execute a SharedPreferences task inside a Coroutine. I'm just dealing with primitive types so it's just out of curiosity
g
SharePreferences blocks thread on first access and on commit() This also true when you use it without coroutines. So if you want very strict about blocking, you should wrap access to shared preferences to Dispatcher.IO
👍 1
a
You might be interested in this once the alpha releases begin: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:datastore/
👍 2
😮 3
c
Oh nice, thank you guys. Appreciated 👍