// Init - Only required method you call to setup GameThrive to recieve push notifications. // Call this on the first scene that is loaded. // appId = Your GameThrive app id from gamethrive.com // googleProjectNumber = Your google project number that is only required for Android GCM pushes. // inNotificationDelegate = Calls this delegate when a notification is opened or one is received when the user is in your game. // autoRegister = Set false to delay the iOS accept notification system prompt. Defaults true. // You can then call RegisterForPushNotifications at a better point in your game to prompt them. public static void Init(string appId, string googleProjectNumber, NotificationReceived inNotificationDelegate, bool autoRegister) { #if !UNITY_EDITOR #if GAMETHRIVE_PLATFORM if (initialized) return; #if UNITY_ANDROID gameThrivePlatform = new GameThriveAndroid(gameObjectName, googleProjectNumber, appId); #elif UNITY_IPHONE gameThrivePlatform = new GameThriveIOS(gameObjectName, appId, autoRegister); #elif UNITY_WP8 gameThrivePlatform = new GameThriveWP(appId); #endif notificationDelegate = inNotificationDelegate; #if !UNITY_WP8 GameObject go = new GameObject(gameObjectName); go.AddComponent<GameThrive>(); DontDestroyOnLoad(go); #endif initialized = true; #endif #else print("Please run GameThrive on a device to see push notifications."); #endif }
// Init - Only required method you call to setup GameThrive to recieve push notifications. // Call this on the first scene that is loaded. // appId = Your GameThrive app id from gamethrive.com // googleProjectNumber = Your google project number that is only required for Android GCM pushes. // inNotificationDelegate = Calls this delegate when a notification is opened or one is received when the user is in your game. // autoRegister = Set false to delay the iOS accept notification system prompt. Defaults true. // You can then call RegisterForPushNotifications at a better point in your game to prompt them. public static void Init(string appId, string googleProjectNumber, NotificationReceived inNotificationDelegate, bool autoRegister) { #if !UNITY_EDITOR #if GAMETHRIVE_PLATFORM if (initialized) { return; } #if UNITY_ANDROID gameThrivePlatform = new GameThriveAndroid(gameObjectName, googleProjectNumber, appId); #elif UNITY_IPHONE gameThrivePlatform = new GameThriveIOS(gameObjectName, appId, autoRegister); #elif UNITY_WP8 gameThrivePlatform = new GameThriveWP(appId); #endif notificationDelegate = inNotificationDelegate; #if !UNITY_WP8 GameObject go = new GameObject(gameObjectName); go.AddComponent <GameThrive>(); DontDestroyOnLoad(go); #endif initialized = true; #endif #else print("Please run GameThrive on a device to see push notifications."); #endif }