public static void SendNotification
            (string id
            , DateTime when
            , TimeSpan repeatInterval
            , NotificationData data
            , bool cancelPrevious       = false
            , ScheduleMode scheduleMode = ScheduleMode.None)
        {
            Assert.IsNotNull(id);
            Assert.IsTrue(id.Length > 0);
            Assert.IsNotNull(data);

#if USE_LOCAL_NOTIFICATIONS
            AndroidJavaClass pluginClass = new AndroidJavaClass(managerClassName);
            if (pluginClass == null)
            {
                ReportNoJavaClass(managerClassName);
                return;
            }

            AndroidJavaObject dataObject = PrepareNotificationData(data);
            if (dataObject == null)
            {
                return;
            }

            long timeDeltaMs = Math.Max(0, (long)(when.ToUniversalTime() - DateTime.UtcNow).TotalMilliseconds);

            pluginClass.CallStatic
                ("SetNotification"
                , id
                , timeDeltaMs
                , (repeatInterval != TimeSpan.Zero) ? (long)repeatInterval.TotalMilliseconds : 0
                , cancelPrevious
                , dataObject
                , (int)scheduleMode);
#endif
        }
        private static AndroidJavaObject PrepareNotificationData(NotificationData data)
        {
            AndroidJavaObject dataObject = new AndroidJavaObject(notificationDataClassName);

            if (dataObject != null)
            {
                dataObject.Set("title", data.title);
                dataObject.Set("message", data.message);
                dataObject.Set("ticker", data.ticker);

                if (data.subText != null)
                {
                    dataObject.Set("subText", data.subText);
                }
                else if (data.progressMax > 0)
                {
                    dataObject.Set("progressMax", data.progressMax);
                    dataObject.Set("progress", data.progress);
                    dataObject.Set("progressIndeterminate", data.progressIndeterminate);
                }

                if (data.group != null)
                {
                    dataObject.Set("group", data.group);
                    dataObject.Set("isGroupSummary", data.isGroupSummary);
                }

                dataObject.Set("category", (int)data.category);

                dataObject.Set("autoCancel", data.autoCancel);
                dataObject.Set("localOnly", data.localOnly);
                dataObject.Set("ongoing", data.ongoing);
                dataObject.Set("onlyAlertOnce", data.onlyAlertOnce);
                dataObject.Set("priority", (int)data.priority);

                dataObject.Set("useSound", data.useSound);
                dataObject.Set("customSoundName", data.customSoundName);

                dataObject.Set("showWhen", data.showWhen);
                if (data.customWhen != NotificationData.noCustomWhen)
                {
                    dataObject.Set("useCustomWhen", true);
                    dataObject.Set("customWhen", data.customWhen);
                }

                dataObject.Set("whenIsChronometer", data.whenIsChronometer);
                dataObject.Set("chronometerCountdown", data.chronometerCountdown);

                dataObject.Set("color", (data.color.a << 24) | (data.color.r << 16) | (data.color.g << 8) | data.color.b);

                dataObject.Set("useVibration", data.useVibration);
                if (data.vibrationPattern != null)
                {
                    dataObject.Call("SetVibrationPattern", data.vibrationPattern);
                }

                dataObject.Set("useLights", data.useLights);
                dataObject.Set("lightsColor", (data.lightsColor.a << 24) | (data.lightsColor.r << 16) | (data.lightsColor.g << 8) | data.lightsColor.b);
                dataObject.Set("lightsOn", data.lightsOn);
                dataObject.Set("lightsOff", data.lightsOff);

                dataObject.Set("smallIconResource", data.smallIconResource);
                dataObject.Set("largeIconResource", data.largeIconResource);

                dataObject.Set("person", data.person);
            }
            else
            {
                ReportNoJavaClass(notificationDataClassName);
            }
            return(dataObject);
        }