I am working on an React Native app (Android-only, no iOS support) that uses Redux with redux-persist to store a bunch of data. It looks like the only well-supported choice for a redux-persist backend is AsyncStorage. https://github.com/rt2zz/redux-persist#storage-engines
The app starts a Foreground Service that needs to read some state persisted by the React Native app. The Foreground Service is implemented in Java and Kotlin and continues running after the user quits the app. The Foreground Service could use the SQLite3 API as described the following posts.
- Can I access data stored in React Native's AsyncStorage from java layer?
- How to Read AsyncStorage on Android Correctly
However, the AsyncStorage documentation says "On Android, AsyncStorage will use either RocksDB or SQLite based on what is available" (https://facebook.github.io/react-native/docs/asyncstorage). Is there any way to be sure AsyncStorage will use SQLite3 even if RocksDB is present due to some other app installed on the phone? It would suck to have our app break whenever RocksDB is "available".
Additional links I've looked at:
- What are my options for storing data when using React Native? (iOS and Android)
- https://www.npmjs.com/package/react-native-shared-preferences (Another option that doesn't seem to be actively maintained)