Should I use AsyncStorage for large amounts of data?

Viewed 793

We are wanting to implement an offline mode for our react-native application. We will be working with quite large amount of data (aprox. 40-50mb). It is an array of aprox. 16000 objects. As far as I know, there are two ways to save this data.

  1. Using AsyncStorage - android has a limit of 6mb, but I've read somewhere, that it can be increased.

  2. Using json file - Downloading that data as json file using react-native-background-downloader and then using react-native-fs to save it and load it if the user has no connection to internet.

Personally I think that the second option is better, even though it requires permission to file storage.

Am I missing any other factors to consider? Are there any other options for offline access?

1 Answers

In the end opted out for usage of the json file as there is limit on android. On load of the application I take these data and load them into variable in mobX store. Which functions same as any variable. I was afraid that mobile phones will have problem sorting across the 16000 objects in array, but there have been no reports of this thing going wrong so far. (In production for 4-5 months right now)

So basically when you hit "enable offline mode" I ask for the file storage permission and download the file using react-native-fs. Then on the next startup of the application I just read the data off the JSON file.

Related