Home » Android » android – How to read from AsyncStorage in native code (Java, ObjectiveC/Swift)

android – How to read from AsyncStorage in native code (Java, ObjectiveC/Swift)

Posted by: admin May 14, 2020 Leave a comment

Questions:

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.

How to&Answers: