UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BlueprintPlatformLibrary.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
10#include "BlueprintPlatformLibrary.generated.h"
11
14
18UENUM(BlueprintType)
54
55// application state when the game receives a notification
56UENUM(BlueprintType)
58{
59 enum Type : int
60 {
63
66
69
72 };
73}
74
76UCLASS(Blueprintable, BlueprintType, ClassGroup=Mobile, MinimalAPI)
78{
80
81public:
82
91
92 // This is called when the application is about to be deactivated (e.g., due to a phone call or SMS or the sleep button).
93 // The game should be paused if possible, etc...
94 UPROPERTY(BlueprintAssignable)
95 FPlatformDelegate ApplicationWillDeactivateDelegate;
96
97 // Called when the application has been reactivated (reverse any processing done in the Deactivate delegate)
98 UPROPERTY(BlueprintAssignable)
99 FPlatformDelegate ApplicationHasReactivatedDelegate;
100
101 // This is called when the application is being backgrounded (e.g., due to switching
102 // to another app or closing it via the home button)
103 // The game should release shared resources, save state, etc..., since it can be
104 // terminated from the background state without any further warning.
105 UPROPERTY(BlueprintAssignable)
106 FPlatformDelegate ApplicationWillEnterBackgroundDelegate; // for instance, hitting the home button
107
108 // Called when the application is returning to the foreground (reverse any processing done in the EnterBackground delegate)
109 UPROPERTY(BlueprintAssignable)
110 FPlatformDelegate ApplicationHasEnteredForegroundDelegate;
111
112 // This *may* be called when the application is getting terminated by the OS.
113 // There is no guarantee that this will ever be called on a mobile device,
114 // save state when ApplicationWillEnterBackgroundDelegate is called instead.
115 UPROPERTY(BlueprintAssignable)
116 FPlatformDelegate ApplicationWillTerminateDelegate;
117
118 // Called when the OS is running low on resources and asks the application to free up any cached resources, drop graphics quality etc.
119 UPROPERTY(BlueprintAssignable)
120 FPlatformDelegate ApplicationShouldUnloadResourcesDelegate;
121
122 // Called with arguments passed to the application on statup, perhaps meta data passed on by another application which launched this one.
123 UPROPERTY(BlueprintAssignable)
124 FPlatformStartupArgumentsDelegate ApplicationReceivedStartupArgumentsDelegate;
125
126 // called when the user grants permission to register for remote notifications
127 UPROPERTY(BlueprintAssignable)
128 FPlatformRegisteredForRemoteNotificationsDelegate ApplicationRegisteredForRemoteNotificationsDelegate;
129
130 // called when the user grants permission to register for notifications
131 UPROPERTY(BlueprintAssignable)
132 FPlatformRegisteredForUserNotificationsDelegate ApplicationRegisteredForUserNotificationsDelegate;
133
134 // called when the application fails to register for remote notifications
135 UPROPERTY(BlueprintAssignable)
136 FPlatformFailedToRegisterForRemoteNotificationsDelegate ApplicationFailedToRegisterForRemoteNotificationsDelegate;
137
138 // called when the application receives a remote notification
139 UPROPERTY(BlueprintAssignable)
140 FPlatformReceivedRemoteNotificationDelegate ApplicationReceivedRemoteNotificationDelegate;
141
142 // called when the application receives a local notification
143 UPROPERTY(BlueprintAssignable)
144 FPlatformReceivedLocalNotificationDelegate ApplicationReceivedLocalNotificationDelegate;
145
146 // called when the application receives a screen orientation change notification
147 UPROPERTY(BlueprintAssignable)
148 FPlatformScreenOrientationChangedDelegate ApplicationReceivedScreenOrientationChangedNotificationDelegate;
149
150public:
151
152 ENGINE_API virtual void PostInitProperties() override;
153 ENGINE_API virtual void BeginDestroy() override;
154
155private:
157 void ApplicationWillDeactivateDelegate_Handler() { ApplicationWillDeactivateDelegate.Broadcast(); }
158 void ApplicationHasReactivatedDelegate_Handler() { ApplicationHasReactivatedDelegate.Broadcast(); }
159 void ApplicationWillEnterBackgroundDelegate_Handler()
160 {
162 ApplicationWillEnterBackgroundDelegate.Broadcast();
163 }
164 void ApplicationHasEnteredForegroundDelegate_Handler() { ApplicationHasEnteredForegroundDelegate.Broadcast(); }
165 void ApplicationWillTerminateDelegate_Handler() { ApplicationWillTerminateDelegate.Broadcast(); }
166 void ApplicationShouldUnloadResourcesDelegate_Handler() { ApplicationShouldUnloadResourcesDelegate.Broadcast(); }
167 void ApplicationReceivedStartupArgumentsDelegate_Handler(const TArray<FString>& StartupArguments) { ApplicationReceivedStartupArgumentsDelegate.Broadcast(StartupArguments); }
168 void ApplicationRegisteredForRemoteNotificationsDelegate_Handler(TArray<uint8> inArray) { ApplicationRegisteredForRemoteNotificationsDelegate.Broadcast(inArray); }
169 void ApplicationRegisteredForUserNotificationsDelegate_Handler(int32 inInt) { ApplicationRegisteredForUserNotificationsDelegate.Broadcast(inInt); }
170 void ApplicationFailedToRegisterForRemoteNotificationsDelegate_Handler(FString inFString) { ApplicationFailedToRegisterForRemoteNotificationsDelegate.Broadcast(inFString); }
171 void ApplicationReceivedRemoteNotificationDelegate_Handler(FString inFString, int32 inAppState);
172 void ApplicationReceivedLocalNotificationDelegate_Handler(FString inFString, int32 inInt, int32 inAppState);
173 void ApplicationReceivedScreenOrientationChangedNotificationDelegate_Handler(int32 inScreenOrientation);
174
175};
176
177UCLASS(meta=(ScriptName="PlatformLibrary"), MinimalAPI)
179{
181
182 static ENGINE_API ILocalNotificationService* platformService;
183
184public:
185
187 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
189
198 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
199 static ENGINE_API int32 ScheduleLocalNotificationAtTime(const FDateTime& FireDateTime, bool LocalTime, const FText& Title, const FText& Body, const FText& Action, const FString& ActivationEvent);
200
209 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
210 static ENGINE_API int32 ScheduleLocalNotificationFromNow(int32 inSecondsFromNow, const FText& Title, const FText& Body, const FText& Action, const FString& ActivationEvent);
211
217 UFUNCTION(BlueprintCallable, Category = "Platform|LocalNotification")
218 static ENGINE_API int32 ScheduleLocalNotificationBadgeAtTime(const FDateTime& FireDateTime, bool LocalTime, const FString& ActivationEvent);
219
224 UFUNCTION(BlueprintCallable, Category = "Platform|LocalNotification")
225 static ENGINE_API void ScheduleLocalNotificationBadgeFromNow(int32 inSecondsFromNow, const FString& ActivationEvent);
226
230 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
231 static ENGINE_API void CancelLocalNotification(const FString& ActivationEvent);
232
236 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
237 static ENGINE_API void CancelLocalNotificationById(int32 NotificationId);
238
244 UFUNCTION(BlueprintCallable, Category="Platform|LocalNotification")
246
252 UFUNCTION(BlueprintPure, Category="Platform|LocalNotification")
253 static ENGINE_API EScreenOrientation::Type GetDeviceOrientation();
254
263 UFUNCTION(BlueprintPure, Category = "Platform|LocalNotification")
264 static ENGINE_API EScreenOrientation::Type GetAllowedDeviceOrientation();
265
269 UFUNCTION(BlueprintCallable, Category = "Platform|LocalNotification")
270 static ENGINE_API void SetAllowedDeviceOrientation(EScreenOrientation::Type NewAllowedDeviceOrientation);
271
272private:
273
275
276 static EDeviceScreenOrientation ConvertToDeviceScreenOrientation(EScreenOrientation::Type ScreenOrientation);
277};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EDeviceScreenOrientation
Definition GenericPlatformMisc.h:236
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define SCOPED_ENTER_BACKGROUND_EVENT(Name)
Definition PlatformMisc.h:234
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Text.h:385
Definition LocalNotification.h:15
virtual int32 ScheduleLocalNotificationBadgeAtTime(const FDateTime &FireDateTime, bool LocalTime, const FString &ActivationEvent)=0
virtual void CancelLocalNotification(const FString &ActivationEvent)=0
virtual void ClearAllLocalNotifications()=0
virtual int32 ScheduleLocalNotificationAtTime(const FDateTime &FireDateTime, bool LocalTime, const FText &Title, const FText &Body, const FText &Action, const FString &ActivationEvent)=0
virtual void GetLaunchNotification(bool &NotificationLaunchedApp, FString &ActivationEvent, int32 &FireDate)=0
Definition Array.h:670
Definition BlueprintFunctionLibrary.h:16
Definition BlueprintPlatformLibrary.h:179
Definition GameInstance.h:152
Definition BlueprintPlatformLibrary.h:78
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FPlatformReceivedLocalNotificationDelegate, FString, inString, int32, inInt, EApplicationState::Type, inAppState)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlatformRegisteredForRemoteNotificationsDelegate, const TArray< uint8 > &, inArray)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlatformStartupArgumentsDelegate, const TArray< FString > &, StartupArguments)
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FPlatformDelegate)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlatformScreenOrientationChangedDelegate, EScreenOrientation::Type, inScreenOrientation)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlatformRegisteredForUserNotificationsDelegate, int32, inInt)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FPlatformReceivedRemoteNotificationDelegate, FString, inString, EApplicationState::Type, inAppState)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPlatformFailedToRegisterForRemoteNotificationsDelegate, FString, inString)
Definition BlueprintPlatformLibrary.h:58
Type
Definition BlueprintPlatformLibrary.h:60
Definition BlueprintPlatformLibrary.h:20
Type
Definition BlueprintPlatformLibrary.h:22
Definition DateTime.h:76