public CrossPlatformNotification CreateNotification(string title, long fireAfterSec, eNotificationRepeatInterval repeatInterval) { // User info IDictionary userInfo = new Dictionary <string, string>(); // userInfo["data"] = "custom data"; CrossPlatformNotification.iOSSpecificProperties _iosProperties = new CrossPlatformNotification.iOSSpecificProperties(); _iosProperties.HasAction = false; _iosProperties.AlertAction = null; CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new CrossPlatformNotification.AndroidSpecificProperties(); _androidProperties.ContentTitle = title; _androidProperties.TickerText = title; _androidProperties.LargeIcon = "App-Icon.png"; //Keep the files in Assets/PluginResources/Android or Common folder. CrossPlatformNotification notification = new CrossPlatformNotification(); notification.AlertBody = title; //On Android, this is considered as ContentText notification.FireDate = DateTime.Now.AddSeconds(fireAfterSec); notification.RepeatInterval = repeatInterval; notification.SoundName = "Notification.mp3"; //Keep the files in Assets/PluginResources/Android or iOS or Common folder. notification.UserInfo = userInfo; notification.iOSProperties = _iosProperties; notification.AndroidProperties = _androidProperties; return(notification); }
private bool DisplayAlertDialog(CrossPlatformNotification _notification) { string _title = string.Empty; string _message = _notification.AlertBody; bool _canShowAlert = !string.IsNullOrEmpty(_message); string _ok = "View"; #if UNITY_ANDROID CrossPlatformNotification.AndroidSpecificProperties _androidProperties = _notification.AndroidProperties; if (_androidProperties != null) { _title = _androidProperties.ContentTitle; } #elif UNITY_IOS CrossPlatformNotification.iOSSpecificProperties _iosProperties = _notification.iOSProperties; if (_iosProperties != null && _iosProperties.HasAction) { if (!string.IsNullOrEmpty(_iosProperties.AlertAction)) { _ok = _iosProperties.AlertAction; } } #endif if (_canShowAlert) { return(EditorUtility.DisplayDialog(_title, _message, _ok, "Cancel")); } return(false); }
private CrossPlatformNotification CreateNotification(System.DateTime _date, string content, eNotificationRepeatInterval _repeatInterval) { // User info IDictionary _userInfo = new Dictionary <string, string>(); _userInfo["data"] = "custom data"; CrossPlatformNotification.iOSSpecificProperties _iosProperties = new CrossPlatformNotification.iOSSpecificProperties(); _iosProperties.HasAction = true; _iosProperties.AlertAction = content; CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new CrossPlatformNotification.AndroidSpecificProperties(); _androidProperties.ContentTitle = Application.productName; // "银之守墓人"; _androidProperties.TickerText = content; _androidProperties.LargeIcon = "hualing.png"; //Keep the files in Assets/PluginResources/Android or Common folder. CrossPlatformNotification _notification = new CrossPlatformNotification(); _notification.AlertBody = content; //On Android, this is considered as ContentText _notification.FireDate = _date; _notification.RepeatInterval = _repeatInterval; _notification.SoundName = ""; //Keep the files in Assets/PluginResources/Android or iOS or Common folder. _notification.UserInfo = _userInfo; _notification.iOSProperties = _iosProperties; _notification.AndroidProperties = _androidProperties; return(_notification); }
private CrossPlatformNotification CreateNotification(long _fireAfterSec, eNotificationRepeatInterval _repeatInterval) { // User info IDictionary _userInfo = new Dictionary <string, string>(); _userInfo["data"] = "custom data"; CrossPlatformNotification.iOSSpecificProperties _iosProperties = new CrossPlatformNotification.iOSSpecificProperties(); _iosProperties.HasAction = true; _iosProperties.AlertAction = "alert action"; CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new CrossPlatformNotification.AndroidSpecificProperties(); _androidProperties.ContentTitle = "content title"; _androidProperties.TickerText = "ticker ticks over here"; _androidProperties.LargeIcon = "NativePlugins.png"; //Keep the files in Assets/PluginResources/Android or Common folder. CrossPlatformNotification _notification = new CrossPlatformNotification(); _notification.AlertBody = "alert body"; //On Android, this is considered as ContentText _notification.FireDate = System.DateTime.Now.AddSeconds(_fireAfterSec); _notification.RepeatInterval = _repeatInterval; _notification.SoundName = "Notification.mp3"; //Keep the files in Assets/PluginResources/Android or iOS or Common folder. _notification.UserInfo = _userInfo; _notification.iOSProperties = _iosProperties; _notification.AndroidProperties = _androidProperties; return(_notification); }
private CrossPlatformNotification CreateNotification(long _fireAfterSec) { // User info IDictionary _userInfo = new Dictionary <string, string>(); _userInfo["data"] = "add what is required"; CrossPlatformNotification.iOSSpecificProperties _iosProperties = new CrossPlatformNotification.iOSSpecificProperties(); _iosProperties.HasAction = true; _iosProperties.AlertAction = "alert action"; CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new CrossPlatformNotification.AndroidSpecificProperties(); _androidProperties.ContentTitle = "content title"; _androidProperties.TickerText = "ticker ticks over here"; _androidProperties.CustomSound = "song.mp3"; //_androidProperties.CustomSound = "soundname.mp3" //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder. //_androidProperties.LargeIcon = "icon.png" //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder. CrossPlatformNotification _notification = new CrossPlatformNotification(); _notification.AlertBody = "alert body"; //On Android, this is considered as ContentText _notification.FireDate = System.DateTime.Now.AddSeconds(_fireAfterSec); _notification.UserInfo = _userInfo; _notification.iOSProperties = _iosProperties; _notification.AndroidProperties = _androidProperties; return(_notification); }
protected void OnNotificationReceived(CrossPlatformNotification _notification) { // Update properties alertBody.Value = _notification.AlertBody; fireDate.Value = _notification.FireDate.ToString(dateTimeFormat.Value); soundName.Value = _notification.SoundName; notificationID.Value = _notification.GetNotificationID(); // Update iOS properties CrossPlatformNotification.iOSSpecificProperties _iOSProperties = _notification.iOSProperties; if (_iOSProperties != null) { alertAction.Value = _iOSProperties.AlertAction; hasAction.Value = _iOSProperties.HasAction; badgeCount.Value = _iOSProperties.BadgeCount; launchImage.Value = _iOSProperties.LaunchImage; } CrossPlatformNotification.AndroidSpecificProperties _androidProperties = _notification.AndroidProperties; if (_androidProperties != null) { contentTitle.Value = _androidProperties.ContentTitle; tickerText.Value = _androidProperties.TickerText; tag.Value = _androidProperties.Tag; largeIcon.Value = _androidProperties.LargeIcon; } Fsm.Event(receivedEvent); }
protected void initializeAndroidProperties() { CrossPlatformNotification.AndroidSpecificProperties properties = new CrossPlatformNotification.AndroidSpecificProperties(); properties.ContentTitle = androidContentTitle; properties.TickerText = androidTickerText; properties.LargeIcon = androidLargeIcon; androidProperties = properties; }
private CrossPlatformNotification CreateNotification(long _fireAfterSec, eNotificationRepeatInterval _repeatInterval) { // User info IDictionary _userInfo = new Dictionary <string, string>(); _userInfo["data"] = "add what is required"; CrossPlatformNotification.iOSSpecificProperties _iosProperties = new CrossPlatformNotification.iOSSpecificProperties(); _iosProperties.HasAction = true; _iosProperties.AlertAction = GMS.appName; CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new CrossPlatformNotification.AndroidSpecificProperties(); _androidProperties.ContentTitle = GMS.amigoData.nombre; _androidProperties.TickerText = GMS.appName; _androidProperties.CustomSound = "Notification.mp3"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder. //_androidProperties.LargeIcon = "NativePlugins.png"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder. if (GMS.checkImageExists(GMS.amigoData.foto)) { _androidProperties.LargeIcon = Application.persistentDataPath + "/" + GMS.amigoData.foto; } else { _androidProperties.LargeIcon = "default.jpg"; } CrossPlatformNotification _notification = new CrossPlatformNotification(); _notification.AlertBody = MgsTextNotif; //On Android, this is considered as ContentText _notification.FireDate = System.DateTime.Now.AddSeconds(_fireAfterSec); _notification.RepeatInterval = _repeatInterval; _notification.UserInfo = _userInfo; _notification.iOSProperties = _iosProperties; _notification.AndroidProperties = _androidProperties; return(_notification); }
public override void OnEnter() { #if USES_NOTIFICATION_SERVICE CrossPlatformNotification _notification = new CrossPlatformNotification(); if (!alertBody.IsNone) { _notification.AlertBody = alertBody.Value; } _notification.FireDate = System.DateTime.Now.AddMinutes(fireAfterMinutes.Value); _notification.RepeatInterval = repeatInterval; if (!soundName.IsNone) { _notification.SoundName = soundName.Value; } // Set iOS specific notification properties CrossPlatformNotification.iOSSpecificProperties _iosSpecificProperties = new CrossPlatformNotification.iOSSpecificProperties(); if (!alertAction.IsNone) { _iosSpecificProperties.AlertAction = alertAction.Value; } if (!hasAction.IsNone) { _iosSpecificProperties.HasAction = hasAction.Value; } if (!badgeCount.IsNone) { _iosSpecificProperties.BadgeCount = badgeCount.Value; } if (!launchImage.IsNone) { _iosSpecificProperties.LaunchImage = launchImage.Value; } // Set android specific notification properties CrossPlatformNotification.AndroidSpecificProperties _androidSpecificProperties = new CrossPlatformNotification.AndroidSpecificProperties(); if (!contentTitle.IsNone) { _androidSpecificProperties.ContentTitle = contentTitle.Value; } if (!tickerText.IsNone) { _androidSpecificProperties.TickerText = tickerText.Value; } if (!tag.IsNone) { _androidSpecificProperties.Tag = tag.Value; } if (!largeIcon.IsNone) { _androidSpecificProperties.LargeIcon = largeIcon.Value; } // Set platform specific properties _notification.iOSProperties = _iosSpecificProperties; _notification.AndroidProperties = _androidSpecificProperties; // Schedules a new notification notificationID.Value = NPBinding.NotificationService.ScheduleLocalNotification(_notification); #endif Finish(); }