コンテンツにスキップ

Unreal

Hive SDK Unreal Engineは、通知機能を使用するための設定を提供します。

アンドロイド

このセクションでは、Androidに必要な設定について説明します。

プッシュサービスの選択

  1. Unreal Editorで、メニューのEdit > Project Settingsをクリックします。プロジェクト設定ウィンドウが表示されます。
  2. プロジェクト設定ウィンドウの左パネルで、Hive SDKの下にあるDependency – Androidをクリックします。
  3. Hive SDK Dependency – Android画面の右ペインで、プッシュセクションのPush Typeに使用するプッシュサービスを選択します。例えば、Firebase Cloud Messagingを使用している場合は、Google FCMを選択します。

Hive コンソール設定: リモートプッシュ

リモートプッシュを使用するには、GoogleまたはApple Consoleからプッシュ証明書を取得し、Hiveコンソールに登録する必要があります

iOS

このセクションでは、iOSに必要な設定について説明します。

プッシュサービスの選択

Unreal iOSはデフォルトでApple Push Notification Serviceを含みます。

アンリアルエンジンの変更

Hive SDKが提供する通知機能を使用するには、Unreal Engineを修正する必要があります。以下のファイルのAddAdd Endコメントの間の行、またはAddコメントのある行を追加してください。


エンジン/ソース/ランタイム/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

エンジン/ソース/ランタイム/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<NSString*, id> * 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<NSString*, id> *)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 コンソール設定: リモートプッシュ

リモートプッシュを使用するには、GoogleまたはApple Consoleからプッシュ証明書を取得し、Hiveコンソールに登録する必要があります