Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is AsyncStorage shared across apps?

My question originates from the docs: https://facebook.github.io/react-native/docs/asyncstorage.html#clear

AsyncStorage.clear -> Erases all AsyncStorage for all clients, libraries, etc....

does that mean that all apps share the same AsyncStorage?

like image 925
Ali Ismayilov Avatar asked Feb 14 '18 15:02

Ali Ismayilov


People also ask

Where does AsyncStorage store data?

On iOS, AsyncStorage is backed by native code that stores small values in a serialized dictionary and larger values in separate files. On Android, AsyncStorage will use either RocksDB or SQLite based on what is available.

How does AsyncStorage store data?

Using the setItem() method The setItem method saves data to the AsyncStorage and allows a key and a value. Here, the key is a string that the data or value is assigned to: // React Native component const value = { name: "Chimezie", job: "Software Developer" }; const storeUser = async () => { try { await AsyncStorage.

What is the difference between AsyncStorage and Redux?

AsyncStorage is an asynchronous, persistent, key-value storage system that is global to the entire app. Redux Persist is a tool used to seamlessly save the application's Redux state object to AsyncStorage . On app launch, Redux Persist retrieves this persisted state and saves it back to Redux.

How secure is AsyncStorage?

According to official RN docs, AsyncStorage is an asynchronous and unencrypted key-value store. Because it is unencrypted, nothing persisted in AsyncStorage should be considered as secured.


1 Answers

AsyncStorage is not shared between multiple apps. Every app runs it it's own sandbox environment and has no access to other apps.

To call AsyncStorage.clear only means you will delete all data which your app has stored in AsyncStorage.

That includes

  • all data which was stored by a library that uses AsyncStorage like https://github.com/sunnylqm/react-native-storage
  • all data from all users (in case of multi user)

For more information about app sandboxing you can read this answer: What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how

like image 78
Alexander Kuttig Avatar answered Nov 16 '22 00:11

Alexander Kuttig