Skip to content

This project demonstrates how to build an Android cloud application with offline data persistence capabilities, similar to Google Keep and WhatsApp. The application utilizes a real-time database that ensures data is persistently stored locally even when the app is offline or restarted

Notifications You must be signed in to change notification settings

Bornmajor/offline-data-sync-app

Repository files navigation

Offline Cloud data persistence android app

This project demonstrates how to build an Android application with offline data persistence capabilities, similar to Google Keep and WhatsApp. The application utilizes a real-time database that ensures data is persistently stored locally even when the app is offline or restarted.

Problem solving

In modern mobile applications, ensuring data persistence is crucial for a seamless user experience. This project showcases the implementation of an Android app with robust offline persistence features. By maintaining a local copy of data alongside cloud storage, the app guarantees data availability regardless of network conditions.

Features

  • Offline Data Storage: tore and sync data with our NoSQL cloud database. Data is synced across all clients in realtime, and remains available when your app goes offline.
  • Real-Time Database: Synchronize local data with the cloud when the device goes online..
  • Auto Sync: Automatically updates cloud data with local changes once the connection is restored.
  • User-Friendly Interface: Simple and intuitive UI for managing data entries.

Technology used

  1. Firebase Realtime Database(https://firebase.google.com/docs/database) -Store and sync data with our NoSQL cloud database. Data is synced across all clients in realtime, and remains available when your app goes offline.
  2. React Native Firebase(https://rnfirebase.io/) - firebase SDK
  3. React Native Async storage (https://react-native-async-storage.github.io/async-storage/docs/install/) - storing auth tokens.
  4. NoSQL database
  5. React Native Paper(https://callstack.github.io/react-native-paper/) - Cross-platform Material Design for React Native
  6. Figma - for prototype design

Get started

Setup

  1. Set Up Firebase Project and Realtime Database
  • Create a Firebase Project: Go to the Firebase Console.Click on "Add Project" and follow the steps to create a new project.
  • Add Realtime Database:Go project overview.Create an app choose web.In your Firebase project, navigate to the "Database" section in the left-hand menu. Click on "Create Database" in the Realtime Database section.Choose the location for your database and set the security rules. For development purposes, you can start in test mode.
  1. Add Firebase SDK to Your React Native Project. Install the Firebase packages: Ensure you have installed the necessary Firebase packages:
npm install @react-native-firebase/app @react-native-firebase/database
  1. Initialize Firebase in Your App: You need to initialize Firebase in your app’s entry file (usually App.js or index).You can get the config of database from project you created in firebase console
import firebase from '@react-native-firebase/app';
import database from '@react-native-firebase/database';

const firebaseConfig = {
 apiKey: "YOUR_API_KEY",
 authDomain: "YOUR_AUTH_DOMAIN",
 databaseURL: "YOUR_DATABASE_URL",
 projectId: "YOUR_PROJECT_ID",
 storageBucket: "YOUR_STORAGE_BUCKET",
 messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
 appId: "YOUR_APP_ID",
};

if (!firebase.apps.length) {
 firebase.initializeApp(firebaseConfig);
}
  1. Ensure Configuration Files are Correctly Placed: For Android: Ensure google-services.json is in the root directory.

  2. Install other dependencies:

    npm install @react-native-community/netinfo @react-native-paper @react-navigation/native @react-native-async-storage/async-storage
  3. Start the app

     npx expo start

In the output, you'll find options to open the app in a

You can start developing by editing the files inside the src/ directory. This project uses file-based routing.

App shots (Android Emulator os android version 10)

offline-sync-figma-preview

Splash & Auth screen

studio64_CuuGwCYE0t studio64_MddeKBOdCM

Home screens

studio64_X04qLq6rL3 studio64_oLfS7GQ0Wz studio64_NffQClFk1b studio64_60sHmSZ7cn studio64_xOKTO8tb6q studio64_LzwtyRNs01

Online vs offline mode (showcase offline persistence capabilities)

studio64_oLfS7GQ0Wz studio64_60sHmSZ7cn

Others

studio64_dXVoQYmPF9

Learn more

To learn more about developing your project with Expo, look at the following resources:

About

This project demonstrates how to build an Android cloud application with offline data persistence capabilities, similar to Google Keep and WhatsApp. The application utilizes a real-time database that ensures data is persistently stored locally even when the app is offline or restarted

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published