public void Init(NotificationsSettings settings, INotificationListener listener) { // Store the settings for later references. mSettings = settings; // Convert category groups to JSON. Invalid groups (empty name or ID) will be // automatically ignored in native side. var categoryGroupJson = AndroidNotificationHelper.ToJson(settings.CategoryGroups); // Convert categories to JSON. var categories = new List <NotificationCategory>(); categories.Add(settings.DefaultCategory); if (settings.UserCategories != null) { categories.AddRange(settings.UserCategories); } var categoriesJson = AndroidNotificationHelper.ToJson(categories.ToArray()); // Listener info var name = listener.Name; var backgroundNotificationMethod = Helper.GetMethodName(listener.NativeNotificationFromBackgroundHandler); var foregroundNotificationMethod = Helper.GetMethodName(listener.NativeNotificationFromForegroundHandler); // Initialize native Android client, which may send some launch notification data during the process. AndroidNotificationNative._InitNativeClient(categoryGroupJson, categoriesJson, name, backgroundNotificationMethod, foregroundNotificationMethod); mIsInitialized = true; }
public void GetPendingLocalNotifications(Action <NotificationRequest[]> callback) { Helper.NullArgumentTest(callback); callback = Helper.ToMainThread <NotificationRequest[]>(callback); AndroidNotificationNative._GetPendingLocalNotifications( androidRequests => { var requests = new NotificationRequest[androidRequests.Length]; for (int i = 0; i < androidRequests.Length; i++) { requests[i] = androidRequests[i].ToCrossPlatformNotificationRequest(); } callback(requests); } ); }
public void ScheduleLocalNotification(string id, TimeSpan delay, NotificationContent content, NotificationRepeat repeat) { if (!mIsInitialized) { Debug.Log("Please initialize first."); return; } AndroidNotificationNative._ScheduleLocalNotification( id, (long)delay.TotalSeconds, repeat == NotificationRepeat.None ? -1 : (long)repeat.ToSecondInterval(), content.title, content.body, content.userInfo != null ? Json.Serialize(content.userInfo) : "", string.IsNullOrEmpty(content.categoryId) ? mSettings.DefaultCategory.id : content.categoryId, // use Default category if none is specified content.smallIcon, content.largeIcon ); }
public void RemoveAllDeliveredNotifications() { AndroidNotificationNative._CancelAllShownNotifications(); }
public void CancelAllPendingLocalNotifications() { AndroidNotificationNative._CancelAllPendingLocalNotificationRequests(); }
public void CancelPendingLocalNotification(string id) { AndroidNotificationNative._CancelPendingLocalNotificationRequest(id); }