Installation and initialization
To integrate AppMetrica Push SDK into Flutter, use the AppMetrica Push SDK for Flutter plugin:
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 clipboardAfter 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- Add
appmetrica_plugin
andappmetrica_push_plugin
import:import 'package:appmetrica_plugin/appmetrica_plugin.dart'; import 'package:appmetrica_push_plugin/appmetrica_push_plugin.dart';
Copied to clipboard Initialize the AppMetrica SDK library using
AppMetrica.activate
and your API key:AppMetrica.activate(AppMetricaConfig("insert_your_api_key_here"));
Copied to clipboardInitialize the AppMetrica Push SDK using
AppMetricaPush.activate
and your API key:AppMetricaPush.activate();
Copied to clipboard
iOS configuration
- Add the SSL certificate to AppMetrica according to the instructions.
- Add Capability Push Notifications to your XCode project.