Installation and initialization

To integrate AppMetrica Push SDK into Flutter, use the AppMetrica Push SDK for Flutter plugin:

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

    flutter pub add appmetrica_push_plugin
    Copied to clipboard

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

    dependencies:
        appmetrica_push_plugin: ^0.3.0
    Copied to clipboard
  2. Add appmetrica_plugin and appmetrica_push_plugin import:
    import 'package:appmetrica_plugin/appmetrica_plugin.dart';
    import 'package:appmetrica_push_plugin/appmetrica_push_plugin.dart';
    Copied to clipboard
  3. Initialize the AppMetrica SDK library using AppMetrica.activate and your API key:

    AppMetrica.activate(AppMetricaConfig("insert_your_api_key_here"));
    Copied to clipboard
  4. Initialize the AppMetrica Push SDK using AppMetricaPush.activate and your API key:

    AppMetricaPush.activate();
    Copied to clipboard
  5. To complete the integration of sending push notifications, use the documentation for each native platform: Android and iOS.

iOS configuration

  1. Add the SSL certificate to AppMetrica according to the instructions.
  2. Add Capability Push Notifications to your XCode project.