# Firebase setup

This guide will walk you through the basic steps to configure Firebase for both Android and iOS. Once set up, your app will benefit for free, these features:

* Google Login
* Phone Number Login
* Push Notifications with (Firebase cloud messaging - FCM)
* Firebase Crashlytics
* Google Analytics
* Firebase Monitoring
* Google Places (For Nearby Location)

### Step 1: Configure Firebase

#### Step 1.1: Create Project in Firebase Console

1. Open [https://console.firebase.google.com](https://console.firebase.google.com/).
2. Click on “Add project” and follow the instructions to create a new Firebase project.

#### Step 1.2: Add Firebase to Your iOS App

1. Open your Firebase project console.
2. Click the gear icon in the upper left corner and select **Project settings**.
3. In the **Your apps** section, select the iOS icon.
4. Fill in the information:
   * **iOS Bundle ID**: Use the bundle ID from your application. Ensure it's in reverse domain format (e.g., if your domain is example.com, the bundle ID should be `com.example.app`). Use only lowercase letters.
   * **App nickname**: This is only for distinguishing between applications on Firebase, so set it arbitrarily.
   * **App Store ID**: This parameter can be omitted.
5. Click **Register app**.
6. Download the `GoogleService-Info.plist` file and save it for later use.
7. Click **Next**.
8. Click **Skip this step**.
9. Complete the process of creating an iOS application on Firebase.

#### Step 1.3: Add Firebase to Your Android App

1. Open your Firebase project console.
2. Click the gear icon in the upper left corner and select **Project settings**.
3. In the **Your apps** section, select the Android icon.
4. Fill in the information:
   * **Android package name**: Use the package name from your application. Ensure it's in reverse domain format (e.g., if your domain is example.com, the package name should be `com.example.app`). Use only lowercase letters.
5. Click **Register app** (you can omit the Debug signing certificate SHA-1 parameter).
6. Download the `google-services.json` file and save it for later use.
7. Click **Next**.
8. Since your project setup is already complete, click **Next** to skip adding the Firebase SDK.
9. If Firebase does not detect your test device, click **Skip this step** to continue. If detected, click **Continue to console**.
10. Complete the process of creating an Android application on Firebase.

### Step 2: Set Up Authentication

<mark style="background-color:green;">This Step is</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">**opcional**</mark><mark style="background-color:green;">, complete it only if you want to Enable</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">**Google Login**</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">or</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">**Phone Login.**</mark>\ <mark style="background-color:green;">You can skip them or one of them if you don't pretend to use it.</mark>

#### Step 2.1: Enable Phone Login

1. In the Firebase console, go to **Authentication**.
2. Click on the **Sign-in method** tab.
3. Enable **Phone** as a sign-in provider.
4. Save your changes.

#### Step 2.2: Enable Google Login

1. In the Firebase console, go to **Authentication**.
2. Click on the **Sign-in method** tab.
3. Enable **Google** as a sign-in provider.
4. You will be prompted to choose the **Email** and **Project name**
5. Save your changes.

<mark style="color:purple;">**Make sure that at the end of this progress, you have downloaded and saved for later use 2 files:**</mark>

* `google-services.json`
* `GoogleService-Info.plist`<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dative.me/firebase-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
