I have a background service I wrote in native (Java/ObjectiveC) that needs to access data from AsyncStorage in react native. I would like to know if there is an easy way to get this value directly from the native code instead of having to pass it manually through a bridge method.
Since this is a background service that runs even if the app is not running (in Android), it can not call the Javascript code when it needs this data. I could work around it (by setting it in native at the same time I set it in AsyncStorage) but it would be a lot more work.
If you meant this one: https://reactnative.dev/docs/asyncstorage then, it's deprecated. I recommended react-native-default-preference: https://github.com/kevinresol/react-native-default-preference
On Android, it used SharedPreference
, so if you use the same preference name. You should able to read it on Android native code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With