public static void SendNotificationToUser(UserNotification notification) { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.SendNotificationToUser(notification); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static void SetNotificationListener(IPusheNotificationListener listener) { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.SetNotificationListener(listener); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static void DisableCustomSound() { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.DisableCustomSound(); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static void RemoveNotificationChannel(string channelId) { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.RemoveNotificationChannel(channelId); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static void EnableNotifications() { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.EnableNotification(); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static void DisableNotificationForceForegroundAware() { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.DisableNotificationForceForegroundAware(); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
public static bool IsCustomSoundEnabled() { #if UNITY_ANDROID && !UNITY_EDITOR return(PusheNotification.IsCustomSoundEnabled()); #elif UNITY_IOS && !UNITY_EDITOR // not implemented return(true); #endif return(false); }
public static bool IsForceForegroundAware() { #if UNITY_ANDROID && !UNITY_EDITOR return(PusheNotification.IsForceForegroundAware()); #elif UNITY_IOS && !UNITY_EDITOR // not implemented return(false); #endif return(false); }
private void InitializeSomeMethods() { // Listen to Register PusheUnity.OnPusheRegistered(OnPusheRegisteredSuccessfully); PusheUnity.OnPusheInitialized(() => { PusheUnity.Log("Pushe Modules have initialized successfully."); }); // Set notification listener PusheNotification.SetNotificationListener(new PusheNotifListener()); // Check if pushe is already registered PusheUnity.Log(PusheUnity.IsRegistered() ? "Pushe is registered" : "Pushe is NOT registered!"); }
public static void CreateNotificationChannel( string channelId, string channelName, string description = "", int importance = 4, bool enableLight = true, bool enableVibration = true, long[] vibrationLengths = null, bool showBadge = true, int ledColor = 0) { #if UNITY_ANDROID && !UNITY_EDITOR PusheNotification.CreateNotificationChannel(channelId, channelName, description, importance, enableLight, enableVibration, vibrationLengths, showBadge, ledColor); #elif UNITY_IOS && !UNITY_EDITOR // not implemented #endif }
/** * Called when Pushe is registered. */ private void OnPusheRegisteredSuccessfully() { PusheUnity.Log(" --- Pushe has been REGISTERED to server successfully --- "); var adId = PusheUnity.GetAdvertisingId(); PusheUnity.Log("Ad id: " + adId); var deviceId = PusheUnity.GetDeviceId(); PusheUnity.Log("Device id : " + deviceId); // Pushe Notification PusheUnity.Log("Notification enabled? " + PusheNotification.IsNotificationEnabled()); PusheUnity.Log("Custom sound enabled? " + PusheNotification.IsCustomSoundEnabled()); PusheNotification.CreateNotificationChannel("CustomChannel", "CustomChannel"); // Analytics PusheAnalytics.SendEvent("Some_Event"); PusheAnalytics.SendEcommerceData("EcommerceData", 12.0); PusheUnity.Log("Subscribing to test1"); PusheUnity.Subscribe("test1"); PusheUnity.Log("Set 123123 as custom id"); PusheUnity.SetCustomId("123123"); PusheUnity.Log("CustomId is: " + PusheUnity.GetCustomId()); var tags = new Dictionary <string, string> { { "name", "Mohammad" }, { "age", "25" }, { "birthday", "1435187386" } }; PusheUnity.AddTags(tags); PusheUnity.RemoveTags("name", "age"); PusheUnity.Log("Tags: " + PusheUnity.GetSubscribedTags()); PusheUnity.Log("Topics: " + string.Join(",", PusheUnity.GetSubscribedTopics())); PusheInAppMessaging.DisableInAppMessaging(); PusheUnity.Log("Is in app messaging enabled?" + PusheInAppMessaging.IsInAppMessagingEnabled()); PusheInAppMessaging.EnableInAppMessaging(); PusheUnity.Log("Is in app messaging enabled? " + PusheInAppMessaging.IsInAppMessagingEnabled()); PusheInAppMessaging.TriggerEvent("qqq"); PusheInAppMessaging.SetInAppMessagingListener(new InAppMessagingListener()); }
/** * Called when Pushe is registered. */ private void OnPusheRegisteredSuccessfully() { PusheUnity.Log(" --- Pushe has been REGISTERED to server successfully --- "); var adId = PusheUnity.GetAdvertisingId(); PusheUnity.Log("Ad id: " + adId); var deviceId = PusheUnity.GetDeviceId(); PusheUnity.Log("Device id : " + deviceId); // Pushe Notification PusheUnity.Log("Notification enabled? " + PusheNotification.IsNotificationEnabled()); PusheUnity.Log("Custom sound enabled? " + PusheNotification.IsCustomSoundEnabled()); // PusheNotification.CreateNotificationChannel("CustomChannel", "CustomChannel"); PusheUnity.Log("Sending d2d"); PusheNotification.SendNotificationToUser(UserNotification.WithDeviceId(PusheUnity.GetDeviceId()).SetTitle("Title").SetContent("Content")); // Analytics PusheAnalytics.SendEvent("Some_Event"); PusheAnalytics.SendEcommerceData("EcommerceData", 12.0); PusheUnity.Log("Subscribing to test1"); PusheUnity.Subscribe("test1"); PusheUnity.Log("Set 123123 as custom id"); PusheUnity.SetCustomId("123123"); PusheUnity.Log("CustomId is: " + PusheUnity.GetCustomId()); var tags = new Dictionary <string, string> { { "name", "Mohammad" }, { "age", "25" }, { "birthday", "1435187386" } }; PusheUnity.AddTags(tags); PusheUnity.RemoveTags("name", "age"); PusheUnity.Log("Tags: " + PusheUnity.GetSubscribedTags()); PusheUnity.Log("Topics: " + string.Join(",", PusheUnity.GetSubscribedTopics())); // InAppMessaging PusheInAppMessaging.DisableInAppMessaging(); PusheUnity.Log("Is in app messaging enabled?" + PusheInAppMessaging.IsInAppMessagingEnabled()); PusheInAppMessaging.EnableInAppMessaging(); PusheUnity.Log("Is in app messaging enabled? " + PusheInAppMessaging.IsInAppMessagingEnabled()); PusheInAppMessaging.TriggerEvent("qqq"); PusheInAppMessaging.SetInAppMessagingListener(new InAppMessagingListener()); // FCM token and ... var fcmToken = PusheUnity.GetFcmToken(); var hmsToken = PusheUnity.GetHmsToken(); var activeService = PusheUnity.GetActiveService(); PusheUnity.Log("Fcm token: " + fcmToken + "\nHms token: " + hmsToken + "\nActive service: " + activeService); // Foreground awareness feature of notification PusheUnity.Log("Are all notifications aware of foreground state? " + PusheUnity.IsForceForegroundAware()); PusheUnity.Log("Toggle to true"); PusheUnity.EnableNotificationForceForegroundAware(); PusheUnity.Log("Are all notifications aware of foreground state? " + PusheUnity.IsForceForegroundAware()); PusheUnity.Log("Toggle back to false"); PusheUnity.DisableNotificationForceForegroundAware(); PusheUnity.Log("Are all notifications aware of foreground state? " + PusheUnity.IsForceForegroundAware()); }