Connecting the AppMetrica Push SDK
Before using the AppMetrica Push SDK, you need to enable and initialize the AppMetrica SDK version 3.2.0 or higher.
Step 1. Download the AppMetrica Push SDK library.
Step 2. Initialize the library in the application by adding to the App.xaml.cs file the Activate()
method call. Call it in the OnLaunched
method implementation of the App.xaml.cs
or in the MainPage
constructor of your application:
... YandexMetricaPush.Activate(AppSid); ...
Copied to clipboard
ms-app://
prefix and the identifier value. For example, ms-app://s-1-15-2-3792079137-3272192291-....
.WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString(); method.ToString();
.Step 3. Configure handling the opening of push notifications. You can use either Windows Push Notification Services or Microsoft Push Notification Service for working with push notifications in the app. Depending on which service is used, use one of the following methods to configure handling push notifications:
- Windows Push Notification Services (WNS)
-
In the
OnLaunched
method for theApplication
class, add theProcessApplicationLaunch
method call for theYandexMetricaPush
class:protected override void OnLaunched(LaunchActivatedEventArgs e) { YandexMetricaPush.ProcessApplicationLaunch(e); ... }
Copied to clipboard - Microsoft Push Notification Service (MPNS)
-
In the
OnNavigatedTo
method for thePage
class (the start page specified in the push notification parameters), add theProcessApplicationLaunch
method call for theYandexMetricaPush
class:protected override void OnNavigatedTo(NavigationEventArgs e) { YandexMetricaPush.ProcessApplicationLaunch(e); ... }
Copied to clipboard