> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valmi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Android Push Notifications

> Push notifications are a great way to keep your users engaged and informed about your app. In this guide, you'll learn how to configure a `sync` at `valmi.io` and to display them to your users.

## Introduction

`Firebase Cloud Messaging (FCM)` is the core service in [Firebase](https://firebase.google.com) that enables sending `push notifications` to `Android` devices. It provides a reliable and scalable infrastructure for delivering messages to targeted users or devices. `FCM` supports various messaging types, including notification messages and data messages.

<Note>**Prerequisite** To create a sync in valmi.io, it is essential to integrate Firebase into your Android app beforehand.</Note>

## Creating Service Account Credentials

> * Go to the [Firebase console](console.firebase.google.com) and select your project.
> * Click on the gear icon located in the top-left corner and navigate to `Project settings`.
> * In the `Service Accounts` tab, scroll down to find the section titled "Firebase Admin SDK" and click on the `Generate New Private Key` button.
> * A dialog box will appear with a warning about the sensitivity of the generated private key. Read the information carefully and click on the `Generate Key` button.
> * The private key file will be downloaded automatically. It is a JSON file containing your Service Account credentials.

<Frame caption="Firebase Admin Console">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/firebase-service-account.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=fe4a7fa5cb4fc74762abb4a0601f438d" width="933" height="610" data-path="images/connectors/android-push-notifications/firebase-service-account.png" />
</Frame>

## Creating Firebase Connection on valmi.io

* Go to `destinations` on `valmi.io` and click on `+DESTINATION` to create a new destination. Select `Android Push Notifications` as the destination.

<Frame caption="Selecting Destination">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/create-destination-select.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=530a13e81777e419ab3dfb51e2748aae" width="1229" height="695" data-path="images/connectors/android-push-notifications/create-destination-select.png" />
</Frame>

* Provide the desired `Connection Name` and uploaded the `Firebase Service Account` details file from the [Firebase console](console.firebase.google.com).

<Frame caption="Configuring Destination">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/create-destination-configure.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=5f0a4d690f34f72bb3667d618d0247b9" width="1229" height="400" data-path="images/connectors/android-push-notifications/create-destination-configure.png" />
</Frame>

* Click on `Next` to create the destination. If the connection details are valid, the destination will be created successfully.

## Setting up the sync

### Supported Sync Modes

`Android Push Notifications` supports the following destination sync modes. Please refer to the [Destination Sync Modes](/concepts/syncs#destination-sync-modes) for more information on the different destination modes.

| Destination Mode | Supported |
| :--------------- | :-------- |
| Append           | ✅         |

### 1. Creation

Go to the `syncs` section in [valmi.io](valmi.io) and click on the `+SYNC` button to initiate the creation of a new sync.

### 2. Warehouse and Destination Selection

* Choose the desired data source for your sync. This could be any of the supported sources.
* Select "Android Push Notifications" as the destination for your sync. And proceed to the `mapping` page.

### 3. Mapping Source Columns to Destination Fields

* On the `Mapping` page, map the source columns to the destination fields. The following table lists the supported destination fields. these fields can be used to create `templated` push notifications.

<Frame caption="Fields Mapping">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/create-sync-mapping.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=4488557aae31681b42557f5d8f1099b4" width="994" height="937" data-path="images/connectors/android-push-notifications/create-sync-mapping.png" />
</Frame>

* Click on the `Next` button. Provide a `name` for your sync and `schedule` it to run at the desired frequency.

### 4. Verifying the `Sync` run

* On the `sync` page

<Frame caption="Sync runs page">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/sync-success-sync-page.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=656056f017fc6c6492b3db0ada22f002" width="1242" height="402" data-path="images/connectors/android-push-notifications/sync-success-sync-page.png" />
</Frame>

* On [Firebase Console](console.firebase.google.com), navigate to `Cloud Messaging` and click on `View FCM reporting dashboard` to view the push notification statistics.

<Frame caption="Reports on Firebase console page">
  <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/sync-success-firebase-console-reports.png?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=97b2cca9c81d298ee5291142d9ef3526" width="948" height="505" data-path="images/connectors/android-push-notifications/sync-success-firebase-console-reports.png" />
</Frame>

* On the mobile device ( Demo App ), App should receive the push notification.

<CardGroup cols={2}>
  <Card color="#ea5a0c">
    <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/sync-success-demo-app-01.jpg?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=3224e04a5f08b733d40562ec825ab51d" width="576" height="1280" data-path="images/connectors/android-push-notifications/sync-success-demo-app-01.jpg" />
  </Card>

  <Card color="#ea5a0c">
    <img src="https://mintcdn.com/valmiio/C3NJ_0tt5zy7s_b0/images/connectors/android-push-notifications/sync-success-demo-app-02.jpg?fit=max&auto=format&n=C3NJ_0tt5zy7s_b0&q=85&s=f335d5b0b612ec3e35a92ce8ca9093b4" width="576" height="1280" data-path="images/connectors/android-push-notifications/sync-success-demo-app-02.jpg" />
  </Card>
</CardGroup>
