internal static void OnReceivedRemoteNotification(iOSNotificationData data) { var notification = new iOSNotification(data.identifier); notification.data = data; s_OnRemoteNotificationReceived(notification); }
internal static void onSentNotification(iOSNotificationData data) { var notification = new iOSNotification(data.identifier); notification.data = data; onNotificationReceived(notification); }
static iOSNotificationWithUserInfo NotificationDataToDataWithUserInfo(iOSNotificationData data) { iOSNotificationWithUserInfo ret; ret.data = data; ret.data.userInfo = IntPtr.Zero; ret.userInfo = NSDictionaryToCs(data.userInfo); return(ret); }
public static void ScheduleLocalNotification(iOSNotificationData data) { #if UNITY_IOS && !UNITY_EDITOR IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(data)); Marshal.StructureToPtr(data, ptr, false); _ScheduleLocalNotification(ptr); #endif }
public static iOSNotificationData?GetLastNotificationData() { #if UNITY_IOS && !UNITY_EDITOR if (_GetAppOpenedUsingNotification()) { IntPtr ptr = _GetLastNotificationData(); if (ptr != IntPtr.Zero) { iOSNotificationData data = (iOSNotificationData)Marshal.PtrToStructure(ptr, typeof(iOSNotificationData)); _FreeUnmanagediOSNotificationDataArray(ptr, 1); return(data); } } #endif return(null); }
static iOSNotificationData[] MarshalAndFreeNotificationDataArray(IntPtr ptr, int count) { if (count == 0 || ptr == IntPtr.Zero) { return(null); } var dataArray = new iOSNotificationData[count]; var structSize = Marshal.SizeOf(typeof(iOSNotificationData)); var next = ptr; for (var i = 0; i < count; ++i) { dataArray[i] = (iOSNotificationData)Marshal.PtrToStructure(next, typeof(iOSNotificationData)); next = next + structSize; } _FreeUnmanagediOSNotificationDataArray(ptr, count); return(dataArray); }
/// <summary> /// Specify a <see cref="iOSNotification.Identifier"/> and create a notification object with all optional fields set to default values. /// </summary> /// <param name="identifier"> Unique identifier for the local notification tha can later be used to track or change it's status.</param> public iOSNotification(string identifier) { data = new iOSNotificationData(); data.identifier = identifier; data.title = ""; data.body = ""; data.badge = -1; data.subtitle = ""; data.categoryIdentifier = ""; data.threadIdentifier = ""; data.data = ""; data.showInForeground = false; data.showInForegroundPresentationOptions = (int)(PresentationOption.Alert | PresentationOption.Sound); data.triggerType = -1; data.repeats = false; //Time trigger data.timeTriggerInterval = -1; //Calendar trigger data.calendarTriggerYear = -1; data.calendarTriggerMonth = -1; data.calendarTriggerDay = -1; data.calendarTriggerHour = -1; data.calendarTriggerMinute = -1; data.calendarTriggerSecond = -1; //Location trigger data.locationTriggerCenterX = 0f; data.locationTriggerCenterY = 0f; data.locationTriggerRadius = 2f; data.locationTriggerNotifyOnEntry = true; data.locationTriggerNotifyOnExit = false; }
internal iOSNotification(iOSNotificationData data) { this.data = data; }
private static extern void _ScheduleLocalNotification(iOSNotificationData data);
public static void NotificationReceived(iOSNotificationData data) { #if UNITY_IOS && !UNITY_EDITOR iOSNotificationCenter.OnSentNotification(NotificationDataToDataWithUserInfo(data)); #endif }
public static void ScheduleLocalNotification(iOSNotificationData data) { #if UNITY_IOS && !UNITY_EDITOR _ScheduleLocalNotification(data); #endif }
public static void RemoteNotificationReceived(iOSNotificationData data) { #if UNITY_IOS && !UNITY_EDITOR iOSNotificationCenter.OnReceivedRemoteNotification(data); #endif }
internal static void OnSentNotification(iOSNotificationData data) { var notification = new iOSNotification(data); s_OnNotificationReceived(notification); }