Skip to content
Advertisement

What is the best way to develop a offline first application in React Native?

Offline applications is a feature that permits the user to access mobile apps without the Internet.

On my requirement, I would like to create an app that allows users to save data such as pictures and videos while they are offline and upload them when they connect to the internet.

What is the best way to achieve my goal, and what are my data storage options?

Advertisement

Answer

its a good statement,

You can start of by integrating https://github.com/andpor/react-native-sqlite-storage .Its a good offline storage mechanism,

2nd: Im guessing youve already integrated an image picker, so basically now on imagePicker response of selecting an image succesfully, you need to save that URI in sql lite database whenever the user is OFFLINE. WHEn user is ONLINE dont add in SQL lite, instead directly upload those Image URI’s to backend

3rd. Now also keep track of all the number of rows in database, whenerv user comes back ONLINE, you can start uploading every row (which contains URI) one by one, and once its done, delete each row in SQL lite

Hope it helps, feel free for doubts

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement