---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://appmetrica.yandex.com/docs/en/sdk/flutter/push/quick-start.md
  - https://appmetrica.yandex.com/docs/ru/sdk/flutter/push/quick-start.md
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.com/docs/en/llms.txt

# Installation and initialization

To integrate AppMetrica Push SDK into Flutter, use the [AppMetrica Push SDK for Flutter](https://pub.dev/packages/appmetrica_push_plugin) plugin:

1. Install the AppMetrica Push SDK plugin in your project. From the root of the project, run the command:

   ```bash translate=no
   flutter pub add appmetrica_push_plugin
   ```

   After adding the plugin, you'll see a line with the following dependency in the `pubspec.yaml` file:

   ```java translate=no
   dependencies:
       appmetrica_push_plugin: ^3.0.1
   ```

2. Add `appmetrica_plugin` and `appmetrica_push_plugin` import:

   ```java translate=no
   import 'package:appmetrica_plugin/appmetrica_plugin.dart';
   import 'package:appmetrica_push_plugin/appmetrica_push_plugin.dart';
   ```

3. Initialize the AppMetrica SDK library using `AppMetrica.activate` and your API key:

   ```bash translate=no
   AppMetrica.activate(AppMetricaConfig("insert_your_api_key_here"));
   ```

4. Initialize the AppMetrica Push SDK using `AppMetricaPush.activate` and your API key:

   ```bash translate=no
   AppMetricaPush.activate();
   ```

5. To complete the integration of sending push notifications, use the documentation for each native platform:

   {% list tabs %}

   - Android

      1\. [Set up](https://appmetrica.yandex.com/docs/en/sdk/android/push/android-settings.md#firebase) the app for using Firebase. [Get and add to AppMetrica](https://appmetrica.yandex.com/docs/en/sdk/android/push/android-settings.md#firebase-key) a server key for using Firebase Cloud Messaging:

      2\. Connect Firebase transport by adding the following dependencies to the `android/app/build.gradle` file:

      ```kotlin translate=no
      dependencies {
         implementation "com.google.firebase:firebase-messaging: 22.0.0"
         implementation "com.google.android.gms:play-services-base: 17.5.0"
      }
      ```

      3\. Initialize Firebase transport using one of the following methods:

      {% cut "Using Google Services Plugin" %}

      1\. [Download](https://support.google.com/firebase/answer/7015592) the configuration file `google-services.json` and put it in the project module's directory (such as `app`).

      2\. For the file to work correctly, enable the Google Services plugin in the project by adding the following lines to the Gradle file:

      ##### project

      * **build.gradle.kts**

         ```kotlin translate=no
         buildscript {
               dependencies {
                  classpath("com.google.gms:google-services:4.4.0")
               }
            }
         ```

      * **build.gradle**

         ```groovy translate=no
         buildscript {
            dependencies {
               classpath "com.google.gms:google-services:4.4.0"
            }
         }
         ```

      ##### application (module)

      * **app/build.gradle.kts**

         ```kotlin translate=no
         apply(plugin = "com.google.gms.google-services")
         ```

      * **app/build.gradle**

         ```groovy translate=no
         apply plugin: "com.google.gms.google-services"
         ```

      {% endcut %}

      {% cut "Without using the plugin" %}

      Make changes in the `application` element in the `AndroidManifest.xml` file:

      ```xml translate=no
      <meta-data android:name="ymp_firebase_default_app_id" android:value="APP_ID"/>
      <meta-data android:name="ymp_gcm_default_sender_id" android:value="number:SENDER_ID"/>
      <meta-data android:name="ymp_firebase_default_api_key" android:value="API_KEY"/>
      <meta-data android:name="ymp_firebase_default_project_id" android:value="PROJECT_ID"/>
      ```

      `APP_ID` — ID of the app in Firebase. You can find it in the [Firebase console](https://console.firebase.google.com/): go to the **Project settings**. In the **Your application** section copy the value of the **application ID** field.


      `SENDER_ID` — The unique ID of sender in Firebase. You can find it in the [Firebase console](https://console.firebase.google.com/): go to **Project settings**&nbsp;→ **Cloud Messaging** and copy the value of the **Sender ID** field.


      `API_KEY` — App key in Firebase. You can find it in the `current_key` field of the `google-services.json` file. You can download the file in the [Firebase console](https://support.google.com/firebase/answer/7015592).


      `PROJECT_ID` — App ID in Firebase. You can find it in the `project_id` field of the `google-services.json` file. You can download the file in the [Firebase console](https://console.firebase.google.com/).


      {% endcut %}

      {% cut "Using with other Firebase projects" %}

      Make changes in the `application` element in the `AndroidManifest.xml` file:

      ```xml translate=no
      <meta-data android:name="ymp_firebase_app_id" android:value="APP_ID"/>
      <meta-data android:name="ymp_gcm_sender_id" android:value="number:SENDER_ID"/>
      <meta-data android:name="ymp_firebase_api_key" android:value="API_KEY"/>
      <meta-data android:name="ymp_firebase_project_id" android:value="PROJECT_ID"/>
      ```

      `APP_ID` — ID of the app in Firebase. You can find it in the [Firebase console](https://console.firebase.google.com/): go to the **Project settings**. In the **Your application** section copy the value of the **application ID** field.


      `SENDER_ID` — The unique ID of sender in Firebase. You can find it in the [Firebase console](https://console.firebase.google.com/): go to **Project settings**&nbsp;→ **Cloud Messaging** and copy the value of the **Sender ID** field.


      `API_KEY` — App key in Firebase. You can find it in the `current_key` field of the `google-services.json` file. You can download the file in the [Firebase console](https://support.google.com/firebase/answer/7015592).


      `PROJECT_ID` — App ID in Firebase. You can find it in the `project_id` field of the `google-services.json` file. You can download the file in the [Firebase console](https://console.firebase.google.com/).


      {% note alert %}

      You should initialize default Firebase project.

      {% endnote %}

      {% endcut %}

      4\. If needed, [configure silent push notifications](https://appmetrica.yandex.com/docs/en/sdk/android/push/quick-start.md#settings-of-silent-push) or [enable push tokens update](https://appmetrica.yandex.com/docs/en/sdk/android/push/quick-start.md#actualization).


   - iOS

      1\. Add the SSL certificate to AppMetrica according to the [instructions](https://appmetrica.yandex.com/docs/en/sdk/ios/push/ios-settings.md).

      2\. Add **Capability Push Notifications** to your XCode project.

      3\. If needed, [enable push tokens update](https://appmetrica.yandex.com/docs/en/sdk/ios/push/quick-start.md#actualization) or [configure uploading of attached files](https://appmetrica.yandex.com/docs/en/sdk/ios/push/quick-start.md#download-file).

      4\. [Set up](https://appmetrica.yandex.com/docs/en/sdk/ios/push/ios-settings.md) statistics collection.

   {% endlist %}

<!-- source: en/_includes/feedback-button-3.md -->
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

<a href="../../../troubleshooting/feedback-new">
  <span class="button">Contact support</span>
</a>

<a href="../../../troubleshooting/feedback-docs">
  <span class="button">Suggest an improvement for documentation</span>
</a>
<!-- endsource: en/_includes/feedback-button-3.md -->
