Installation and initialization

AppMetrica Push Unity is a plugin for the Unity3d game platform that includes support for the AppMetrica Push SDK for the Android and iOS platforms.

Before using the AppMetrica Push Unity plugin, you need to enable and initialize the AppMetrica Unity plugin version 4.0.0 or later.

Attention. To update the plugin, delete the Assets/AppMetricaPush directory and import the new plugin version (pay attention to the Android configuration).
  1. Integrating the plugin
  2. Configuring the plugin

Integrating the plugin

Note.

The plugin uses the External Dependency Manager for Unity to resolve dependencies.

Step 1. Download the AppMetrica Push Unity plugin.

Step 2. Add the plugin to the project — open the project in Unity Editor and import the AppMetricaPush.unitypackage plugin (Assets → Import Package → Custom Package).

Step 3. Open the Assets/AppMetricaPush/ folder and drag the AppMetrica prefab to the project's main stage.

If the plugin is integrated this way, the AppMetricaPush script on the added prefab automatically initializes the AppMetrica Push SDK.

The added AppMetricaPush prefab is a singleton. It isn't deleted when switching to a new Unity stage, and it deletes other objects that the AppMetricaPush script is installed on.

Configuring the plugin

To receive push notifications, ask the user for permission. We recommend using the Mobile Notifications Unity package and request permission according to the instructions.

Note. The AppMetrica Push Unity Plugin uses “swizzling”: it intercepts the execution of certain methods of the UnityAppController class by using the ObjectiveC runtime. The code is in the AppMetricaPush/Plugins/iOS/YMPBridge.m file.

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.