Unreal Engine
Plugin installation
The SDK can be found in the devtodev GitHub repository. Download the latest release of the Source code (zip). Unzip the archive and copy the DTDMessaging folder to the Plugins folder of your project.
If you have a C++ type project, add DTDMessaging to the list of dependency names in the <module_name>.Build.cs file of the module in which you plan to use the plugin.
Example:
PublicDependencyModuleNames.Add("DTDMessaging");Android
Add your google-services.json file to the project's root directory. It will be used to configure notifications during the project-building process.
iOS
In the case your Unreal Engine is built from GitHub source code:
Enable notifications in the settings of your project: Edit → Project Settings → iOS → Enable Remote Notifications Support
In the case your Unreal Engine is not built from GitHub source code:
Add the parameter to the engine configuration file (<proj_dir>/Config/DefaultEngine.ini):
// Some code/Script/IOSRuntimeSettings.IOSRuntimeSettings]
bEnableRemoteNotificationsSupport=TrueData types
class UDTDMessagingBPLibrary
class UDTDMessagingBPLibraryA class that implements analytic methods.
Header file:
#include "DTDMessaging/Public/DTDMessagingBPLibrary.h"enum class EDTDNotificationActionType : uint8
enum class EDTDNotificationActionType : uint8Notification action type
Header file:
#include "DTDMessaging/Public/DTDNotificationActionType.h"Values:
- App = 0- default value
- Url = 1- external link opening
- Share = 2- share contentc
- DeepLink = 2- an in-app link opening
struct FDTDNotification
struct FDTDNotificationNotification data container.
Header file:
#include "DTDMessaging/Public/DTDNotification.h"ActionType
EDTDNotificationActionType
Тип действия уведомления
ActionString
FString
Идентификатор действия уведомления
Data
TMap<FString, FString>
Данные уведомления
struct FDTDNotificationAction
struct FDTDNotificationActionNotification action data container.
Header file:
#include "DTDMessaging/Public/DTDNotificationAction.hActionType
EDTDNotificationActionType
Тип действия уведомления
ActionString
FString
Идентификатор действия уведомления
ButtonId
FString
Идентификатор нажатой кнопки
ButtonText
FString
Текст нажатой кнопки
ButtonIcon
FString
Иконка нажатой кнопки
IsBackground
bool
Режим открытия приложения кнопкой
enum class EDTDIOSNotificationOptions : uint8
enum class EDTDIOSNotificationOptions : uint8iOS only
Push Notification display settings are Bitflags that are managed by the developer and allow for selecting the method of user notification. It can be altered by the end user.
By default, it has the value: Badge|Sound|Alert
Header file:
#include "DTDMessaging/Public/DTDIOSNotificationOptions.h"Values:
- None = 0- nothing
- Badge = 1 << 0- can display a badge on the app icon
- Sound = 1 << 1- can play a sound
- Alert = 1 << 2- can display an alert
- CarPlay = 1 << 3- can display a push notification on CarPlay
- CriticalAlert = 1 << 4- critical alerts can play a sound even if Do Not Disturb is enabled (critical alerts require a special entitlement issued by Apple). Available from iOS 12 onwards.
- AppNotificationSettings = 1 << 5- this option defines that the system should display a notification settings button in the app. Available from iOS 12.0 onwards.
- Provisional = 1 << 6- an option for sending provisional notifications to the Notification Center without interrupting functioning processes. Available from iOS 12.0 onwards.
Use this setting to avoid the permission request on app launch because it is seen as intrusive, and most users opt out of it.
It’s also important that when using the Provisional setting, the user needs to go to Notification Center settings to allow explicit notifications.
Delegates
DelegatesHeader file:
#include "DTDMessaging/Public/DTDMessagingDelegates.h"Delegates:
DECLARE_DELEGATE_OneParam(FDTDMessagingBoolParamsDelegate, bool);
DECLARE_DELEGATE_OneParam(FDTDMessagingStringParamsDelegate, const FString&);
DECLARE_DELEGATE_OneParam(FDTDMessagingNotificationParamsDelegate, const FDTDNotification&);
DECLARE_DELEGATE_TwoParams(FDTDMessagingNotificationActionParamsDelegate, const FDTDNotification&, const FDTDNotificationAction&);Initialization
Notification module initialization:

UDTDMessagingBPLibrary::Initialize();Methods
SetAvailability
SetAvailabilityA method responsible for enabling/disabling push notifications. When the state changes, it sends an event that includes the availability status (true or false). The availability status flag is stored in the SDK.

UDTDMessagincgBPLibrary::SetAvailability(true);GetAvailability
GetAvailabilityGet the current availability status flag (true or false):

onResult
- FDTDMessagingDynamicBoolParamsDelegate 
- FDTDMessagingBoolParamsDelegate 
Callback
auto onResult = new FDTDMessagingBoolParamsDelegate();
onResult->BindLambda([](bool value)
{
  // Your code...
});
UDTDMessagingBPLibrary::GetAvailability(*onResult);GetToken
GetTokenGet a current unique device ID used in the notification system:

onResult
- FDTDMessagingDynamicStringParamsDelegate 
- FDTDMessagingStringParamsDelegate 
Callback.
auto onResult = new FDTDMessagingStringParamsDelegate();
onResult->BindLambda([](const FString& value)
{
  // Your code...
});
UDTDMessagingBPLibrary::GetToken(*onResult);SetTokenListener
SetTokenListenerSet a token listener. The listener will be executed when the SDK updates a unique device ID in the notification system.

listener
- FDTDMessagingDynamicStringParamsDelegate 
- FDTDMessagingStringParamsDelegate 
Listener.
auto listener = new FDTDMessagingStringParamsDelegate();
listener->BindLambda([](const FString& value)
{
  // Your code...
});
UDTDMessagingBPLibrary::SetTokenListener(*listener);SetTokenErrorListener
SetTokenErrorListenerSet a listener for errors in token reception. The listener will be executed when an error occurs while the SDK updates a unique device ID in the notification system.

listener
- FDTDMessagingDynamicStringParamsDelegate 
- FDTDMessagingStringParamsDelegate 
Listener.
auto listener = new FDTDMessagingStringParamsDelegate();
listener->BindLambda([](const FString& value)
{
  // Your code...
});
UDTDMessagingBPLibrary::SetTokenErrorListener(*listener);SetNotificationReceiveListener
SetNotificationReceiveListenerSet a listener for notification reception. The listener will be executed when the SDK receives a notification.

listener
- FDTDMessagingDynamicNotificationParamsDelegate 
- FDTDMessagingNotificationParamsDelegate 
Listener.
auto listener = new FDTDMessagingNotificationParamsDelegate();
listener->BindLambda([](const FDTDNotification& notification)
{
  // Your code...
});
UDTDMessagingBPLibrary::SetNotificationReceiveListener(*listener);SetInvisibleNotificationReceiveListener
SetInvisibleNotificationReceiveListenerSet a listener for invisible notification reception. The listener will be executed when the SDK receives an invisible notification.

listener
- FDTDMessagingDynamicNotificationParamsDelegate 
- FDTDMessagingNotificationParamsDelegate 
Listener.
auto listener = new FDTDMessagingNotificationParamsDelegate();
listener->BindLambda([](const FDTDNotification& notification)
{
  // Your code...
});
UDTDMessagingBPLibrary::SetInvisibleNotificationReceiveListener(*listener);SetNotificationActionListener
SetNotificationActionListenerSet a listener for notification activation. The listener will be executed when the notification gets activated.

listener
- FDTDMessagingDynamicNotificationActionParamsDelegate 
- FDTDMessagingNotificationActionParamsDelegate 
Listener.
auto listener = new FDTDMessagingNotificationActionParamsDelegate();
listener->BindLambda([](const FDTDNotification& notification, const FDTDNotificationAction& action)
{
  // Your code...
});
UDTDMessagingBPLibrary::SetNotificationActionListener(*listener);IOSSetNotificationOptions
IOSSetNotificationOptionsiOS only
Set notification parameters.

options
int32
Options.
An int32 type value is used as an argument of this method. However, this argument should be calculated by using enumerators of EDTDIOSNotificationOptions and bitwise OR operator.
int32 options = EDTDIOSNotificationOptions::Badge |
  EDTDIOSNotificationOptions::Sound |
  EDTDIOSNotificationOptions::Alert;
UDTDMessagingBPLibrary::IOSSetNotificationOptions(options);Last updated
Was this helpful?
