Setting Up Firebase
Step 1: Create a Firebase Project
- Go to the Firebase Console.
- Sign in or create an account using your Google account.
- Click on the "Add project" button, enter a project name (e.g., DobuleFoodDelivery), and follow the setup prompts. Disable Google Analytics if it is not required.
Step 2: Add Your Apps to the Project
Register your apps for different platforms:
- For Android:
- Click on the Android icon to add an Android app.
- Enter your app’s package name (found in your Android project’s AndroidManifest.xml).
- (Optional) Enter the app nickname and SHA-1 of your development certificate.
- Download the google-services.json file and place it in the app/ directory of your Android project.
- For iOS:
- Click on the iOS icon to add an iOS app.
- Enter your iOS app’s bundle ID (found in your Xcode project settings).
- (Optional) Enter the app nickname and App Store ID.
- Download the GoogleService-Info.plist file and include it in your Xcode project.
- For Web:
- Click on the web icon to register your web application.
- Enter your app’s nickname.
- Copy the Firebase SDK snippet configured with your app’s credentials and include it in your web app's HTML.
Step 3: Configure Firebase Services
- Navigate to the "Firestore Database" section in the Firebase Console and click "Create database". Choose the appropriate mode and location.
- Go to the "Authentication" section and set up the sign-in methods, such as Email/Password, Google, etc.
- If needed, set up Cloud Storage by navigating to the "Storage" section and following the setup prompts.
Step 4: Install Firebase SDK
Install the Firebase SDK as per the platform requirements:
- For Android and iOS, follow the instructions provided when you registered your app.
- For Web, include the Firebase SDK script tags in your HTML or install via NPM/Yarn if using a JavaScript framework.
Step 5: Initialize Firebase in Your App
Use the configuration files or snippets obtained during app registration to initialize Firebase:
- For Android/iOS, ensure the google-services.json or GoogleService-Info.plist is correctly placed and referenced in your project.
- For Web, use the Firebase config object to initialize Firebase in your JavaScript code.
Step 6: Test Your Setup
Test the Firebase services you have enabled to make sure they are correctly integrated and functioning with your application. This might involve testing sign-ins, Firestore operations, or file uploads to Firebase Storage.
Conclusion
Following these steps will successfully integrate Firebase into your "Dobule - Food Delivery" app, providing a scalable and secure backend for managing user data, authentication, and other essential services.
For a better understanding, please see the video tutorials below: