Unreal
Hive SDK Unreal Engine에서 노티피케이션 기능을 사용하기 위한 설정을 안내합니다.
Android¶
Android에서 필요한 설정을 안내합니다.
푸시 서비스 선택¶
- Unreal Editor의 메뉴에서 Edit > Project Settings을 클릭하세요. Project Settings 창이 나타납니다.
-
Project Settings 창의 좌측 패널에서 Hive SDK 하위의 Dependency – Android를 각 클릭하세요.
-
우측의 Hive SDK Dependency – Android 각 화면에서 Push 항목에 있는 Push Type 사용할 푸시 서비스를 선택하세요. 예를 들어 Firebase Cloud Messaging을 사용하려면 Google FCM을 선택하세요.
Hive 콘솔 설정: 리모트 푸시¶
리모트 Push를 사용하려면 Google 또는 Apple 콘솔에서 Push 인증서를 받아 Hive 콘솔에 등록해야 합니다.
iOS¶
iOS에서 필요한 설정을 안내합니다.
푸시 서비스 선택¶
Unreal iOS는 Apple Push Notification Service를 기본 포함합니다.
Unreal Engine 수정¶
Hive SDK에서 제공하는 Notification 기능을 사용하기 위해 Unreal Engine 수정이 필요합니다. 아래 파일들에서 Add
와 Add End
주석 사이에 있는 라인들 또는 Add
주석이 있는 라인을 추가하세요.
Engine/Source/Runtime/ApplicationCore/Public/IOS/IOSAppDelegate.h
DECLARE_MULTICAST_DELEGATE_FourParams(FOnOpenURL, UIApplication*, NSURL*, NSString*, id);
static FOnOpenURL OnOpenURL;
// Add
DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnOpenURLwithOptions, UIApplication*, NSURL*, NSDictionary* );
static FOnOpenURLwithOptions OnOpenURLwithOptions;
// Add End
// parameters passed from openURL
@property (nonatomic, retain) NSMutableArray* savedOpenUrlParameters;
@property (nonatomic, retain) NSMutableArray* savedOpenUrlWithOptionsParameters; // Add
Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSAppDelegate.cpp
extern bool GShowSplashScreen;
FIOSCoreDelegates::FOnOpenURL FIOSCoreDelegates::OnOpenURL;
FIOSCoreDelegates::FOnOpenURLwithOptions FIOSCoreDelegates::OnOpenURLwithOptions; // Add
FIOSCoreDelegates::FOnWillResignActive FIOSCoreDelegates::OnWillResignActive;
FIOSCoreDelegates::FOnDidBecomeActive FIOSCoreDelegates::OnDidBecomeActive;
TArray FIOSCoreDelegates::PushNotificationFilters;
@synthesize AccessibilityCacheTimer;
#endif
@synthesize savedOpenUrlParameters;
@synthesize savedOpenUrlWithOptionsParameters; // Add
@synthesize BackgroundSessionEventCompleteDelegate;
GShowSplashScreen = false;
}, TStatId(), NULL, ENamedThreads::ActualRenderingThread);
}
// Add
for (NSDictionary* openUrlParameter in self.savedOpenUrlWithOptionsParameters)
{
UIApplication* application = [openUrlParameter valueForKey : @"application"];
NSURL* url = [openUrlParameter valueForKey : @"url"];
NSDictionary \* options = [openUrlParameter valueForKey : @"options"];
FIOSCoreDelegates::OnOpenURLwithOptions.Broadcast(application, url, options);
}
self.savedOpenUrlWithOptionsParameters = nil; // clear after saved openurl delegate running
// Add End
for (NSDictionary\* openUrlParameter in self.savedOpenUrlParameters)
{
UIApplication\* application = [openUrlParameter valueForKey : @"application"];
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
// save launch options
self.launchOptions = launchOptions;
#if PLATFORM_TVOS
self.bDeviceInPortraitMode = false;
#else
// use the status bar orientation to properly determine landscape vs portrait
self.bDeviceInPortraitMode = UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]);
printf("========= This app is in %s mode\n", self.bDeviceInPortraitMode ? "PORTRAIT" : "LANDSCAPE");
#endif
// check OS version to make sure we have the API
OSVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
if (!FPlatformMisc::IsDebuggerPresent() || GAlwaysReportCrash)
{
// InstallSignalHandlers();
}
self.savedOpenUrlParameters = [[NSMutableArray alloc] init];
self.savedOpenUrlWithOptionsParameters = [[NSMutableArray alloc] init]; // Add
self.PeakMemoryTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(RecordPeakMemory) userInfo:nil repeats:YES];
#if !BUILD_EMBEDDED_APP
return YES;
}
// Add
//# use option
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary \*)options
{
#if !NO\_LOGGING
NSLog(@"%s", "IOSAppDelegate openURL options\n");
#endif
NSString\* EncdodedURLString = [url absoluteString];
NSString\* URLString = [EncdodedURLString stringByRemovingPercentEncoding];
FString CommandLineParameters(URLString);
// Strip the "URL" part of the URL before treating this like args. It comes in looking like so:
// "MyGame://arg1 arg2 arg3 ..."
// So, we're going to make it look like:
// "arg1 arg2 arg3 ..."
int32 URLTerminator = CommandLineParameters.Find( TEXT("://"), ESearchCase::CaseSensitive);
if ( URLTerminator > -1 )
{
CommandLineParameters.RightChopInline(URLTerminator + 3, false);
}
FIOSCommandLineHelper::InitCommandArgs(CommandLineParameters);
self.bCommandLineReady = true;
[self.CommandLineParseTimer invalidate];
self.CommandLineParseTimer = nil;
// Save openurl infomation before engine initialize.
// When engine is done ready, running like previous. ( if OnOpenUrl is bound on game source. )
if (bEngineInit)
{
FIOSCoreDelegates::OnOpenURLwithOptions.Broadcast(app, url, options);
}
else
{
#if !NO\_LOGGING
NSLog(@"%s", "Before Engine Init receive IOSAppDelegate openURL\n");
#endif
NSDictionary\* openUrlParameter = [NSDictionary dictionaryWithObjectsAndKeys :
app , @"application",
url, @"url",
options, @"options",
nil];
[savedOpenUrlWithOptionsParameters addObject : openUrlParameter];
}
return YES;
}
// Add End
FCriticalSection RenderSuspend;
- (void)applicationWillResignActive:(UIApplication \*)application
{
Hive 콘솔 설정: 리모트 푸시¶
리모트 Push를 사용하려면 Google 또는 Apple 콘솔에서 Push 인증서를 받아 Hive 콘솔에 등록해야 합니다.