LogoLogo
My AppsLive demoNewsArticles
  • Introduction
  • 📌Product updates: 2025
    • 2024
    • 2023
  • Getting Started
    • Registration
    • Adding a space
    • Adding an app to the space
  • Basic Events & Custom Events
  • Integration
    • Expert Tips
      • What to track
      • Payments & Anti-cheat
      • Check your integration
    • Integration of SDK 2.0+
      • SDK Integration
        • Android
        • iOS
        • macOS
        • Windows
        • Web
          • Web SDK Integration
          • Web SDK Releases
        • Unity
        • Unreal Engine
        • Godot Engine
      • Automatic payment tracking
        • App Store
        • Google Play
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anticheat methods
        • Track sessions
      • Push notifications
        • Android
        • iOS
        • Windows (UWP)
        • Unity
          • Android
          • iOS
          • Windows (UWP/WSA)
        • Unreal Engine
      • A/B testing
        • Description of A/B testing on the SDK side
        • Working with A/B tests in the devtodev interface
        • A/B testing examples
    • Integration of SDK 1.0+ (deprecated)
      • SDK Integration
        • iOS
        • Android
        • Windows 8.1 and 10
        • Web
        • Unity
        • Mac OS
        • Adobe Air
        • UE4
      • Setting up Events
        • Basic methods
        • Secondary methods
        • User profile
        • Anti-cheat Methods
      • Push Notifications
        • IOS
        • Android
        • Windows 8.1 and Windows 10
        • Unity
        • Abode Air
        • UE4
    • Test Devices
    • Server API
      • Data API 2.0
      • Subscription API
      • Push API
        • IOS
        • Android
        • Windows UWP
        • Windows
      • Raw Export
      • Labels API
      • Data API
    • Import historical data via API
    • Data Export
      • Data Export to Cloud Storage (BigQuery / Amazon S3)
  • 3rd Party Sources
    • Attribution Trackers
      • AppsFlyer
      • Adjust
      • Branch.io
      • Kochava
      • Tenjin
      • Tune (MAT)
      • Singular
      • Custom postback API
      • Facebook Ads referral decryption
    • App Marketplace Data
      • App Store Connect Stats
      • App Store Subscriptions
      • Google Play Console Stats
      • Google Play Subscriptions
      • AppGallery Connect Stats
    • Ad revenue
      • AdColony
      • AdMob
      • Facebook
      • MoPub
      • Unity Ads
      • Vungle
      • Ad revenue API
    • Cohort export
  • Reports and Functionality
    • Space-related Reports and Functionality
      • Overview
      • Custom dashboards & Reports
      • SQL
        • SQL tips
        • SQL Query examples
      • Audience overlap
    • Project-related Reports and Functionality
      • Overview
        • Real-Time Dashboard
        • Acquisition reports
        • Engagement reports
        • Monetization reports
        • In-game analysis reports
        • Cohort analysis
      • Reports
      • Push Notifications
        • Android Notifications
        • IOS Notifications
        • Windows Notifications
        • Button Templates
      • Predictions
      • Users & Segments
      • Filters
      • A/B Testing
      • Tuning
      • Settings
  • Metrics and Glossary
    • Ad networks metrics
    • Market Metrics
    • Prediction Metrics
    • SDK Metrics
    • Subscription metrics
  • Space Management
  • User Profile Management
  • Limits
  • Scenarios and Best Practices
    • Analytics use cases
    • Match-3
    • MMORPG Games
    • Hyper-Casual games
    • Social Casino
    • RPG games
    • Farming games
    • Non-gaming app
    • Acquisition Example
  • FAQ
    • Identification
    • Raw Data
    • All about data discrepancies
  • Slack
Powered by GitBook
On this page
  • SDK Integration
  • Android platform features:
  • Windows Store 10 platform features:
  • The specificity of integration on iOS platform
  • Adding Capabilities
  • Creating a new push-notification in devtodev interface

Was this helpful?

Export as PDF
  1. Integration
  2. Integration of SDK 1.0+ (deprecated)
  3. Push Notifications

Unity

PreviousWindows 8.1 and Windows 10NextAbode Air

Last updated 17 days ago

Was this helpful?

This generation of SDK is deprecated and is no longer supported. Information about the .

Push Notifications are available only for the supported platforms: iOS, Android, Windows Store/Windows Phone 8.1/10.

To enable Push Notifications you will have to perform the following actions:

  • Add the application to your space in devtodev system

  • Android. Get API key from Google APIs Console. It is necessary to activate Google Cloud Messaging for Android before key generation. Detailed information on how to receive an API key you can find in native

  • iOS. Generate Developer or Production Certificate for the application and get Private key file (.p12) on its basis. Detailed information on how to receive a Private key file you can find in native

  • Submit the data to the application settings in devtodev system

  • Integrate devtodev SDK to the application (see the "" to learn more about integrating and initializing devtodev SDK)

  • Add several lines of the code to switch in the push notification to the SDK

  • Create a campaign for sending push-notifications in "Push" section

SDK Integration

Android platform features:

Go to and then to your project or create a new one. complete guide on adding your project to Firebase console and enabling Cloud messaging.

Download google-services.json from your Firebase console. Add this file into your project’s Assets folder.

Please do the following to find google-services.json:

  1. Choose your project in the Firebase console

  2. Choose project settings in the Project overview

3. Scroll down to the SDK setup and configuration. Click on the google-services.json

Using devtodev and Firebase Messaging services at the same time

If you want to use both devtodev and Firebase Messaging services at the same time, you need to disable Firebase listener.

  • Find androidmanifest.xml used in your app. If you don’t use Custom Manifest, you need to create it. Tick the Custom Main Manifest checkbox:

  • Add the following line to the “Application” section:

<service android: name = "com.google.firebase.messaging.cpp.ListenerService"
android: exported = "true"
android: enabled = "false"
tools: node = "replace" />
  • You should get something like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.devtodev.unitysdk2" android:versionCode="1" android:versionName="1.0">
  <application android:label="@string/app_name" android:icon="@drawable/app_icon">
    <service android:name="com.google.firebase.messaging.cpp.ListenerService" android:exported="true" android:enabled="false" tools:node="replace" />
    <!-- The MessagingUnityPlayerActivity is a class that extends
         UnityPlayerActivity to work around a known issue when receiving
         notification data payloads in the background. -->
    <activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    </activity>
    <service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="true" />
  </application>
</manifest>

Windows Store 10 platform features:

Build a Windows Store App in Unity. After the app is built, Visual Studio project will be created. Proceed with the following changes.

There is a difference in the implementation of the elements mentioned below for different types of projects:

.NET + D3D: Put the following source in your App class (usually it is an App.cs file) at the end of the ApplicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args)​ function.

private void ApplicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args) {
    //...other code
    DevToDev.ActivatedEventHandler.Handle(args);
}

.NET + XAML: Put the following source in your App class (usually it is an App.xaml.cs file) at the end of the OnLaunched(LaunchActivatedEventArgs args) and OnActivated(IActivatedEventArgs args) functions.

protected override void OnLaunched(LaunchActivatedEventArgs e) {
    //...other code
    DevToDev.ActivatedEventHandler.Handle(e);
}

protected override void OnActivated(IActivatedEventArgs args) {
    //...other source
    DevToDev.ActivatedEventHandler.Handle(args);
}

IL2CPP + XAML: Put the following source in your App class (usually it is App.xaml.cpp file). Add several lines of code in a generated App.xaml.cpp class. After defining headers:

//...headers
extern "C" __declspec(dllimport) void __stdcall AddActivatedEventArgs(IInspectable* activatedEventArgs);

And at the end of of the App::OnLaunched(LaunchActivatedEventArgs^ e) and App::OnActivated(IActivatedEventArgs^ args) functions.

For Example:

void App::OnActivated(IActivatedEventArgs^ args) {
    //...other code
    AddActivatedEventArgs(reinterpret_cast<IInspectable*>(static_cast<Platform::Object^>(args)));
}

void App::OnLaunched(LaunchActivatedEventArgs^ e) {
    //...other code
    auto args = static_cast<IActivatedEventArgs^>(e);
	AddActivatedEventArgs(reinterpret_cast<IInspectable*>(static_cast<Platform::Object^>(args)));
}

IL2CPP + D3D: Put the following source in your App class (usually it is App.cpp file). Add several lines of code in a generated App.cpp class. After defining headers:

//...headers
extern "C" __declspec(dllimport) void __stdcall AddActivatedEventArgs(IInspectable* activatedEventArgs);

And at the end of of the App::OnActivated(CoreApplicationView^ sender, IActivatedEventArgs^ args) function.

void App::OnActivated(CoreApplicationView^ sender, IActivatedEventArgs^ args) {
    //...other code
    AddActivatedEventArgs(reinterpret_cast<IInspectable*>(static_cast<Platform::Object^>(args)));
}

Make sure that these functions are enabled in Package.appmanifest of you project (the flag "Toast capable" is enabled by default for Windows 10+ projects, it is absent in the manifest).

Add the following three Background Tasks in Package.appmanifest:

Entry point for Push Notification tasks type:

devtodev.background.PushNotificationTriggerTask

Entry points for System Event tasks type:

devtodev.background.ToastNotificationActionTriggerTask
devtodev.background.ToastNotificationHistoryChangedTriggerTask

The specificity of integration on iOS platform

  1. Build an iOS App in Unity. After the app is built, Xcode project will be created. Proceed with the following changes

  2. Enable push notifications in your Xcode project

  3. The library provides support for iOS 10 notification attachments, such as images, animated gifs, and video. In order to take advantage of this functionality, you will need to create a notification service extension alongside your main application

  4. Create a new iOS target in Xcode (File -> New -> Target) and select the Notification Service Extension type

  5. ​In Member Center, the Push Notifications service will appear as Configurable (not Enabled) until you create a client SSL certificate

Add devtodevAppExtensions.framework to newly created extension. Make sure that Deployment Target is pointed as iOS 10.0 or higher:

Make sure that field Architectures contains "Standard architectures armv7, arm64" setting both in the project and the extension build settings:

Modify your extension:

  1. Delete all dummy source code for your new extension

  2. Inherit from DTDMediaAttachmentExtension in NotificationService

//NotificationService.h
#import <devtodevAppExtensions/devtodevAppExtensions.h>

@interface NotificationService : DTDMediaAttachmentExtension

@end

//NotificationService.m
#import "NotificationService.h"

@interface NotificationService ()

@end

Adding Capabilities

Use Xcode to enable push notifications in the target’s Capabilities pane:

Enable Background Modes and Remote notifications under the target’s Capabilities section:

Two ways to integrate push notifications:

  • Using the graphic interface:

    1. Open the Window/devtodev menu element

    2. Switch Push Notifications tumbler on

    3. If you need to use push token for some aims or to handle the getting of notifications by user, add the GameObject with the following function to the scene:

      public void PushReceived(IDictionary<string, string> pushAdditionalData) {
           //pushAdditionalData - push-notification data that you send to your app
      }
      
      public void PushOpened(DevToDev.PushMessage pushMessage, DevToDev.ActionButton actionButton) {
           //pushMessage - DevToDev.PushMessage. Represents toast notification message
           //actionButton - DevToDev.ActionButton. Represents toast button that was clicked. Could be null if toast body was clicked
      }
      
      public void PushTokenFailed(string error) {
           //handle push-notifications error here
      }
      
      public void PushTokenReceived(string pushToken) {
           //pushToken - your push token
      }
  • Using code: Before calling Analytics.Initialize add the following strings:

public void PushReceived(IDictionary<string, string> pushAdditionalData) {
     //pushAdditionalData - push-notification data that you send to your app
}

public void PushOpened(DevToDev.PushMessage pushMessage, DevToDev.ActionButton actionButton) {
     //pushMessage - DevToDev.PushMessage. Represents toast notification message
     //actionButton - DevToDev.ActionButton. Represents toast button that was clicked.
     //               Could be null if toast body was clicked
}

public void PushTokenFailed(string error) {
     //handle push-notifications error here
}

public void PushTokenReceived(string pushToken) {
     //pushToken - your push token
}

DevToDev.PushManager.PushReceived = PushReceived;
DevToDev.PushManager.PushOpened = PushOpened;
DevToDev.PushManager.PushTokenFailed = PushTokenFailed;
DevToDev.PushManager.PushTokenReceived = PushTokenReceived;

DevToDev.PushManager.PushNotificationsOptions = (DTDNotificationOptions.Alert | DTDNotificationOptions.Badge | DTDNotificationOptions.Sound | DTDNotificationOptions.Provisional); //Notification options for iOS, optional property
DevToDev.PushManager.PushNotificationsEnabled = true; 

// FOR ANDROID ONLY! Optional. Using custom push-notification icons on Android.
// <summary> To set the custom icons to be shown in push-notification on the SDK part,
// use the following methods.
// Attention! Icons which set in the push-notification wizard 
// have priority over the icons which set in these methods.</summary>
// <param name="iconName">Icon file from resources of your app
// (from Assets/Plugins/Android/res folder)</param>

//FOR ANDROID ONLY! To set the small icon:
DevToDev.PushManager.CustomSmallIcon = iconName;

//FOR ANDROID ONLY! To set the large icon: 
DevToDev.PushManager.CustomLargeIcon = iconName;

Creating a new push-notification in devtodev interface

2. Fill in the campaign name, select an app for delivery 3. Choose a user group to send a message. You can choose an existing segment or create a new one 4. Enter notification details 5. Schedule the delivery 6. That's it!

You can create a campaign only after at least one push token comes from devtodev SDK integrated into your application. Otherwise, the app will not be displayed in the list.

You can read more about the manifest .

You must also associate your application with the Windows Store app (otherwise push notifications will not be delivered). Open "Store->Associate App with the Store" menu, login with your Live ID and pick the appropriate application form the list. A file Package.StoreAssociation.xml will be added into the Project.

Set the target game object, needed script and functions in the interface:

1. Open section and click on the "Add new campaign" button

current version can be found here
Android devtodev SDK documentation
iOS devtodev SDK documentation
SDK integration
Firebase console
Here is
here
PUSH NOTIFICATIONS