This page describes how to use Firebase Phone Number Verification with your Android app in
production. See the [Get started on Android](https://firebase.google.com/docs/phone-number-verification/android/get-started.md.txt) guide to learn
how to test Firebase PNV in an Android app using SIM-less test mode.

Once production mode is active, your app will be able to get verified phone
numbers on real devices, as long as they have supported hardware and a
supported carrier.

## Before you begin

- Implement and test the Firebase PNV user flow and backend integration by following
  the steps in the [Get started on Android](https://firebase.google.com/docs/phone-number-verification/android/get-started.md.txt) guide.

- You must be signed into the Firebase console as a project member with Owner
  privileges on the app's Firebase project.

- You must have a publicly accessible homepage and privacy policy on a custom
  domain that you own to complete OAuth brand verification. You can use
  Firebase Hosting to host these pages, as long as you
  [connect a custom domain](https://firebase.google.com/docs/hosting/custom-domain.md.txt)---default `.web.app` and
  `.firebaseapp.com` domains aren't accepted for brand verification.

## 1. Disable test mode in the app client

Your production client must not call `enableTestSession()`.

If you followed [Get started](https://firebase.google.com/docs/phone-number-verification/android/get-started.md.txt#test-token), release builds already
skip `enableTestSession()`, because the call only runs in debug builds and the
release build sets `FPNV_TEST_TOKEN` to an empty value. Confirm that none of
your release build types or variants set `FPNV_TEST_TOKEN`, and distribute a
release build as your production client.

If you call `enableTestSession()` somewhere else, remove that call from your
production client:

### Kotlin

```kotlin
fpnv.enableTestSession(/* token */)  // Remove this.
```

You can continue to create non-public development builds of your app client that
call `enableTestSession()`.

Note that phone number verification won't work in production until you also
complete the steps in the next section.

## 2. Enable production in your project

Follow these steps to enable Firebase PNV production mode for your Firebase project:

1. Configure API restrictions for the Firebase Phone Number Verification API.

   1. In the Google Cloud console, go to the **APIs \& Services** \>
      [**Credentials** page](https://console.cloud.google.com/apis/credentials?project=_)

   2. Open your Android API key and add the Firebase Phone Number Verification API to the list
      of selected APIs.

      > [!NOTE]
      > **Note:** If you use API restrictions, add `com.google.android.gms` and its SHA-1 value `38918a453d07199354f8b19af05ec6562ced5788` to the exception list in the [**Credentials** page](https://console.cloud.google.com/apis/credentials?project=_) of the Google Cloud console. Without this exception, you will see `PERMISSION_DENIED` errors for `com.google.android.gms` in your app logs.

2. If you haven't already, set up billing.

   Firebase PNV requires the [pay-as-you-go Blaze pricing plan](https://firebase.google.com/pricing.md.txt). If you haven't yet upgraded
   your project to the Blaze pricing plan, you'll be prompted to
   during set up of production mode.
3. If you haven't already, specify your app's SHA-256 fingerprint.

   1. In the Firebase console, go to the
      **Settings** \>
      [**General** tab](https://console.firebase.google.com/project/_/settings/general/).

   2. Scroll down to the **Your apps** card, select your Android app, and add
      your SHA-256 fingerprint in the **SHA certificate fingerprints** field.

   Refer to
   [Authenticating Your Client](https://developers.google.com/android/guides/client-auth)
   for details on how to get your app's SHA-256 fingerprint.
4. Upgrade to production mode.

   1. In the Firebase console, go to the
      **Security** \> **Phone Verification** \>
      [**Overview** tab](https://console.firebase.google.com/project/_/phoneverification/usage?useAutoProject=true),
      and select the **Production** environment.

   2. Click **Upgrade for production**.

      You'll see a list of the apps in your project that will be enabled for
      production, and have the opportunity to add additional apps.
   3. You must submit your app for
      [OAuth brand verification](https://support.google.com/cloud/answer/13464321)
      and a privacy policy review. Google Cloud will verify that you are
      clearly and accurately identifying your app and its privacy policy.

      If you host your homepage and privacy policy on Firebase Hosting (or
      another shared hosting service), make sure you:
      - [Connect a custom domain](https://firebase.google.com/docs/hosting/custom-domain.md.txt) that you control (such as `example.com` or a subdomain of a domain you own). Shared hosting domains such as `.web.app` and `.firebaseapp.com` can't pass domain ownership checks.
      - Verify the custom domain in [Google Search Console](https://search.google.com/search-console) as a **Domain** property using a DNS TXT record (not a URL-prefix property), signed in with an account that has the Owner role on your Google Cloud project.
      - Configure your homepage URL, privacy policy URL, and authorized domains in Google Auth Platform using your custom domain, and make sure your homepage clearly displays your app name, describes what the app does, and links to your privacy policy.

      To begin the review, click **Proceed in Google Cloud**. This process can
      sometimes take 24 hours or more.
   4. While you're waiting for brand verification, review the Firebase Phone Number Verification
      service specific terms, which are linked to from the
      Firebase console.

   5. After you've passed brand verification, check the box to acknowledge the
      service specific terms, and then click **Enable**.

      Firebase Phone Number Verification is now active in production mode.