Пример #1
0
    public IEnumerator SendNotification_CanAccessNativeBuilder()
    {
        var n = new AndroidNotification();

        n.Title    = "SendNotification_CanAccessNativeBuilder";
        n.Text     = "SendNotification_CanAccessNativeBuilder Text";
        n.FireTime = System.DateTime.Now;

        Debug.LogWarning("SendNotification_CanAccessNativeBuilder sends notification");

        using (var builder = AndroidNotificationCenter.CreateNotificationBuilder(n, kDefaultTestChannel))
        {
            using (var extras = builder.Call <AndroidJavaObject>("getExtras"))
            {
                extras.Call("putString", "notification.test.string", "TheTest");
            }

            AndroidNotificationCenter.SendNotification(builder);
        }

        yield return(WaitForNotification(8.0f));

        Debug.LogWarning("SendNotification_CanAccessNativeBuilder completed");

        Assert.AreEqual(1, currentHandler.receivedNotificationCount);
        using (var extras = currentHandler.lastNotification.NativeNotification.Get <AndroidJavaObject>("extras"))
        {
            Assert.AreEqual("TheTest", extras.Call <string>("getString", "notification.test.string"));
        }
    }
Пример #2
0
        public static SimpleResultModel SendToTags(string msg, string tags)
        {
            PushPayload pushPayload = new PushPayload();

            pushPayload.platform     = Platform.android();
            pushPayload.audience     = Audience.s_tag(tags.Split(','));
            pushPayload.notification = new Notification().setAlert(msg);
            AndroidNotification androidnotification = new AndroidNotification();

            androidnotification.setTitle(TITLE);
            pushPayload.notification.AndroidNotification = androidnotification;

            try {
                var result = client.SendPush(pushPayload);
                return(new SimpleResultModel()
                {
                    suc = true, msg = result.msg_id.ToString()
                });
            }
            catch (APIRequestException e) {
                return(new SimpleResultModel()
                {
                    suc = false, msg = "HTTP Status: " + e.Status + ";Error Code: " + e.ErrorCode + ";Error Message: " + e.ErrorMessage
                });
            }
            catch (APIConnectionException e) {
                return(new SimpleResultModel()
                {
                    suc = false, msg = e.message
                });
            }
        }
Пример #3
0
    public static AndroidNotification CreateNotification(NotificationType type, DateTime time, string inputData = "")
    {
        var title   = "Like Water Reminder";
        var message = "";

        switch (type)
        {
        case NotificationType.Water:
            message = LWConfig.WaterNotificationDescription;
            break;

        case NotificationType.Stream:
            message = LWConfig.StreamNotificationDescription;
            break;

        default:
            message = LWConfig.WaterNotificationDescription;
            break;
        }
        var notification = new AndroidNotification
        {
            Title            = title,
            Text             = message,
            FireTime         = time,
            IntentData       = inputData,
            SmallIcon        = "icon_0",
            ShouldAutoCancel = true,
            RepeatInterval   = TimeSpan.FromDays(7)
        };

        return(notification);
    }
 private void UnregisterNotifications()
 {
     AndroidNotification.CancelNotification(HUNGER_NOTIFICATION_ID);
     AndroidNotification.CancelNotification(JOY_NOTIFICATION_ID);
     AndroidNotification.CancelNotification(SLEEP_NOTIFICATION_ID);
     AndroidNotification.CancelNotification(TOILET_NOTIFICATION_ID);
 }
Пример #5
0
        /// <summary>
        ///  推送到单个App Android设备
        /// </summary>
        /// <param name="registrationId"></param>
        /// <param name="MsgContent"></param>
        /// <returns></returns>
        public static PushPayload PushObject_AndroidMsg(string registrationId, string MsgContent)
        {
            string[] register = registrationId.Split(',');


            PushPayload pushPayload = new PushPayload();

            pushPayload.platform = Platform.android();
            pushPayload.audience = Audience.s_registrationId(register);
            var notification = new AndroidNotification().setAlert(MsgContent);


            var message = Message.content(MsgContent);

            message.content_type = "text";
            message.msg_content  = "aaaaaaaaaaa";
            message.setTitle("aaaaa");

            pushPayload.message = message;


            pushPayload.notification            = new Notification().setAndroid(notification);
            pushPayload.options.apns_production = true;
            return(pushPayload);
        }
Пример #6
0
    public override AndroidNotification CreateAndroidNotification()
    {
        AndroidNotification notification = base.CreateAndroidNotification();

        notification.RepeatInterval = GetInterval();
        return(notification);
    }
        private AndroidNotification parseNotificationTemplate(AndroidNotificationTemplate template)
        {
            AndroidNotification newNotification = new AndroidNotification()
            {
                Title = template.Title,
                Text  = template.Text,

                SmallIcon        = template.SmallIcon,
                LargeIcon        = template.LargeIcon,
                Style            = template.NotificationStyle,
                FireTime         = System.DateTime.Now.AddSeconds(template.FireInSeconds),
                Color            = template.Color,
                Number           = template.Number,
                ShouldAutoCancel = template.ShouldAutoCancel,
                UsesStopwatch    = template.UsesStopWatch,
                Group            = template.Group,
                GroupSummary     = template.GroupSummary,
                SortKey          = template.SortKey,
                IntentData       = template.IntentData,
                ShowTimestamp    = template.ShowTimestamp,
                RepeatInterval   = TimeSpan.FromSeconds(template.RepeatInterval),
                //ShowInForeground = template.ShowInForeground
            };

            return(newNotification);
        }
Пример #8
0
        public static PushPayload PushObject_android_with_options()
        {
            PushPayload pushPayload = new PushPayload()
            {
                platform = Platform.android_ios()
            };

            pushPayload.audience = Audience.s_registrationId();

            AndroidNotification androidnotification = new AndroidNotification();

            androidnotification.setAlert("Push Object android with options");
            androidnotification.setBuilderID(3);
            androidnotification.setStyle(1);
            androidnotification.setAlert_type(1);
            androidnotification.setBig_text("big text content");
            androidnotification.setInbox("JSONObject");
            androidnotification.setBig_pic_path("picture url");
            androidnotification.setPriority(0);
            androidnotification.setCategory("category str");

            var notification = new Notification().setAlert("alert content");

            notification.AndroidNotification = androidnotification;
            notification.IosNotification     = new IosNotification();
            notification.IosNotification.incrBadge(1);
            notification.IosNotification.AddExtra("extra_key", "extra_value");
            pushPayload.notification = notification.Check();
            return(pushPayload);
        }
Пример #9
0
    static void CheckAndSend(AndroidNotification notification, string channel, int notificationID)
    {
        var notificationStatus = GetStatus(notificationID);

        Debug.Log(notificationStatus);
        switch (notificationStatus)
        {
        case NotificationStatus.Unavailable:
            Debug.Log($"{notification.Title} Unavailable");
            break;

        case NotificationStatus.Unknown:
            AndroidNotificationCenter.SendNotificationWithExplicitID(notification, channel, notificationID);
            //.Log($"Noti Sent {notification.FireTime}");
            break;

        case NotificationStatus.Scheduled:    // Replace the scheduled notification with a new notification.
            AndroidNotificationCenter.UpdateScheduledNotification(notificationID, notification, channel);
            //.Log($"Noti Updated {notification.FireTime}");
            break;

        case NotificationStatus.Delivered:          // Remove the previously shown notification from the status bar.
            AndroidNotificationCenter.CancelDisplayedNotification(notificationID);
            goto case NotificationStatus.Scheduled; //then update the scheduled
        }
    }
 internal AndroidLocalPush(string _title, string _text, DateTime _fireTime)
 {
     this.notification           = new AndroidNotification(_title, _text, _fireTime);
     this.notification.LargeIcon = "icon_0";
     this.fireTime = _fireTime;
     this.id       = -1;
 }
Пример #11
0
    // Start is called before the first frame update
    void Start()
    {
        AndroidNotificationCenter.CancelAllNotifications();

        defaultChannel = new AndroidNotificationChannel()
        {
            Id          = "default_channel",
            Name        = "Default Channel",
            Description = "Generic Notification",
            Importance  = Importance.Default,
        };

        AndroidNotificationCenter.RegisterNotificationChannel(defaultChannel);

        AndroidNotification notification = new AndroidNotification()
        {
            Title     = "Cruz Vermelha",
            Text      = "Está na hora de prestar primeiros socorros novamente!",
            SmallIcon = "small",
            LargeIcon = "large",
            FireTime  = System.DateTime.Now.AddMinutes(2),
        };

        id = AndroidNotificationCenter.SendNotification(notification, defaultChannel.Id);
    }
Пример #12
0
    public void CheckNotification()
    {
        if (AndroidNotificationCenter.CheckScheduledNotificationStatus(id) == NotificationStatus.Scheduled)
        {
            AndroidNotification newNotification = new AndroidNotification()
            {
                Title     = "Morreu!",
                Text      = "Você morreu",
                SmallIcon = "small",
                LargeIcon = "large",
                FireTime  = System.DateTime.Now.AddSeconds(5),
            };

            AndroidNotificationCenter.CancelNotification(id);
            AndroidNotificationCenter.SendNotification(newNotification, defaultChannel.Id);
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(id) == NotificationStatus.Delivered)
        {
            AndroidNotificationCenter.CancelNotification(id);
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(id) == NotificationStatus.Unknown)
        {
            AndroidNotification notification = new AndroidNotification()
            {
                Title     = "Nova notificação",
                Text      = "Reenvio de notificação",
                SmallIcon = "small",
                LargeIcon = "large",
                FireTime  = System.DateTime.Now.AddSeconds(30),
            };

            id = AndroidNotificationCenter.SendNotification(notification, defaultChannel.Id);
        }
    }
Пример #13
0
    // Start is called before the first frame update
    void Start()
    {
        AndroidNotificationCenter.CancelAllNotifications();

        defaultChannel = new AndroidNotificationChannel()
        {
            Id          = "default_channel",
            Name        = "Default Channel",
            Description = "Generic Notification",
            Importance  = Importance.Default,
        };

        AndroidNotificationCenter.RegisterNotificationChannel(defaultChannel);

        AndroidNotification notification = new AndroidNotification()
        {
            Title     = "Notificação teste",
            Text      = "Descrição de teste",
            SmallIcon = "small",
            LargeIcon = "large",
            FireTime  = System.DateTime.Now.AddSeconds(30),
        };

        id = AndroidNotificationCenter.SendNotification(notification, defaultChannel.Id);
    }
Пример #14
0
        void Awake()
        {
            DDNA.Instance.Settings.BackgroundEventUploadRepeatRateSeconds = 5;
            DDNA.Instance.Settings.BackgroundEventUpload = false;
            // Configure the SDK
            DDNA.Instance.SetLoggingLevel(DeltaDNA.Logger.Level.DEBUG);
            DDNA.Instance.ClientVersion = "1.0.0";

            DDNA.Instance.StartSDK();
            RecordEvent("awake");
#if UNITY_ANDROID
            var channel = new AndroidNotificationChannel()
            {
                Id          = "channel_id",
                Name        = "Default Channel",
                Importance  = Importance.Default,
                Description = "Generic notifications",
            };
            AndroidNotificationCenter.RegisterNotificationChannel(channel);
            var notification = new AndroidNotification();
            notification.Title    = "Your Title";
            notification.Text     = "Your Text";
            notification.FireTime = System.DateTime.Now.AddSeconds(5);

            AndroidNotificationCenter.SendNotification(notification, "channel_id");
            AndroidNotificationCenter.OnNotificationReceived += OnNotificationReceived;
            Input.compass.enabled = true;
            Input.gyro.enabled    = true;
        }
Пример #15
0
    void SetNewNotification()
    {
        AndroidNotification newNotif = new AndroidNotification();

        newNotif.Title    = "You can spin for stars!";
        newNotif.Text     = "Your daily login spin is ready to be collected!";
        newNotif.FireTime = System.DateTime.Now.AddSeconds(30);//GetFireTime();
        identifier        = AndroidNotificationCenter.SendNotification(newNotif, channel.Id);

        AndroidNotificationCenter.NotificationReceivedCallback receivedNotificationHandler = delegate(AndroidNotificationIntentData data)
        {
            var msg = "Notification received: " + data.Id + "\n";
            Debug.Log(msg);
        };


        AndroidNotificationCenter.OnNotificationReceived += receivedNotificationHandler;

        var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent();

        if (notificationIntentData != null)
        {
            Debug.Log("App was opened with notification!");
            AndroidNotificationCenter.CancelAllDisplayedNotifications();
        }
    }
Пример #16
0
 public void SendNotification(AndroidNotification androidNotification, string channel)
 {
     if (GameDataManager.data.enableNotificaions)
     {
         AndroidNotificationCenter.SendNotification(androidNotification, channel);
     }
 }
Пример #17
0
        private void CreateNotification()
        {
#if UNITY_ANDROID
            var androidSettingsChannel = new AndroidNotificationChannel
            {
                Id                   = AndroidNotifierId,
                Name                 = "Game Notifier",
                Importance           = Importance.High,
                CanBypassDnd         = true,
                CanShowBadge         = true,
                Description          = "Enter the game and get free crystals",
                EnableLights         = true,
                EnableVibration      = true,
                LockScreenVisibility = LockScreenVisibility.Public
            };

            AndroidNotificationCenter.RegisterNotificationChannel(androidSettingsChannel);

            var androidSettingsNotification = new AndroidNotification
            {
                Color          = Color.white,
                RepeatInterval = TimeSpan.FromSeconds(30)
            };

            AndroidNotificationCenter.SendNotification(androidSettingsNotification, AndroidNotifierId);
#endif
        }
    AndroidNotification CreateNotificationWithAllParameters()
    {
        var notification = new AndroidNotification();

        notification.Title               = "title";
        notification.Text                = "text";
        notification.SmallIcon           = "small_icon";
        notification.FireTime            = DateTime.Now;
        notification.RepeatInterval      = new TimeSpan(0, 0, 5);
        notification.LargeIcon           = "large_icon";
        notification.Style               = NotificationStyle.BigTextStyle;
        notification.Color               = new Color(0.2f, 0.4f, 0.6f, 1.0f);
        notification.Number              = 15;
        notification.ShouldAutoCancel    = true;
        notification.UsesStopwatch       = true;
        notification.Group               = "group";
        notification.GroupSummary        = true;
        notification.GroupAlertBehaviour = GroupAlertBehaviours.GroupAlertChildren;
        notification.SortKey             = "sorting";
        notification.IntentData          = "string for intent";
        notification.ShowTimestamp       = true;
        notification.ShowInForeground    = false; // this one defaults to true
        notification.CustomTimestamp     = new DateTime(2018, 5, 24, 12, 41, 30, 122);

        return(notification);
    }
Пример #19
0
    public void TriggerExampleNotification()
    {
        var notification = new AndroidNotification(_notificationChannelId, 0, "Example notification",
                                                   string.Format("This is an example notification, triggered at {0}", DateTime.Now.ToShortTimeString()));

        notification.Show();
    }
 AndroidNotificationIntentData SerializeDeserializeNotification(AndroidNotification original, int notificationId)
 {
     using (var builder = AndroidNotificationCenter.CreateNotificationBuilder(notificationId, original, kChannelId))
     {
         return(SerializeDeserializeNotification(builder));
     }
 }
Пример #21
0
    /// <summary>
    /// Androidの通知データのスタック。
    /// </summary>
    /// <param name="notificationData">通知データ。</param>
    /// <param name="channelId">チャンネルId。</param>
    /// <param name="notificationId">通知Id。</param>
    static void StackAndroidNotificationData(AndroidNotification notificationData, string channelId, int notificationId)
    {
        // すでにスタックに登録されているId、通知時間がすぎているもの、リピート時間が設定されていなければ削除する。
        androidNotificationStackList.RemoveAll(
            e => (e.NotificationId == notificationId ||
                  e.IsNowTimeExceededFireTime()) &&
            e.IsRepeatIntervalTimeSpanZero()
            );

        var stackData = new AndroidNotificationStackData();

        stackData.Title    = notificationData.Title;
        stackData.Text     = notificationData.Text;
        stackData.FireTime = notificationData.FireTime;
        if (notificationData.RepeatInterval != null)
        {
            stackData.RepeatInterval = notificationData.RepeatInterval;
        }
        stackData.NotificationChannelId = channelId;
        stackData.NotificationId        = notificationId;
        androidNotificationStackList.Add(stackData);

        // Prefsデータに保存。
        SavePrefsNotificationData();
    }
    public void BasicSerializeDeserializeNotification_WorksWithBinderExtras()
    {
        const int notificationId = 126;

        var original = new AndroidNotification();

        original.FireTime = DateTime.Now.AddSeconds(2);

        var bitmap = CreateBitmap();

        Assert.IsNotNull(bitmap);

        var builder = AndroidNotificationCenter.CreateNotificationBuilder(notificationId, original, kChannelId);
        var extras  = builder.Call <AndroidJavaObject>("getExtras");

        extras.Call("putParcelable", "binder_item", bitmap);

        var deserializedData = SerializeDeserializeNotification(builder);

        var deserializedExtras       = deserializedData.NativeNotification.Get <AndroidJavaObject>("extras");
        var bitmapAfterSerialization = deserializedExtras.Call <AndroidJavaObject>("getParcelable", "binder_item");

        // both these are in extras, so we should have lost bitmap, but preserved fire time
        // bitmap is binder object and can't be parcelled, while our fallback custom serialization only preserves our stuff
        Assert.IsNull(bitmapAfterSerialization);
        Assert.AreEqual(original.FireTime.ToString(), deserializedData.Notification.FireTime.ToString());
    }
Пример #23
0
    public static void createNotification(string title, string body, string subtitle)
    {
        #if UNITY_IPHONE
        var timeTrigger = new iOSNotificationTimeIntervalTrigger()
        {
            TimeInterval = new TimeSpan(0, 0, 1),
            Repeats      = false
        };

        var notification = new iOSNotification()
        {
            // You can specify a custom identifier which can be used to manage the notification later.
            // If you don't provide one, a unique string will be generated automatically.
            Identifier                   = "_notification_01",
            Title                        = title,
            Body                         = body,
            Subtitle                     = subtitle,
            ShowInForeground             = true,
            ForegroundPresentationOption = (PresentationOption.Alert | PresentationOption.Sound),
            CategoryIdentifier           = "category_a",
            ThreadIdentifier             = "thread1",
            Trigger                      = timeTrigger,
        };

        iOSNotificationCenter.ScheduleNotification(notification);
        #elif UNITY_ANDROID
        var notification = new AndroidNotification();
        notification.Title    = title;
        notification.Text     = subtitle;
        notification.FireTime = System.DateTime.Now;

        AndroidNotificationCenter.SendNotification(notification, "channel_id");
        #endif
    }
 AndroidNotificationIntentData SerializeDeserializeNotification(AndroidNotification original, int notificationId, Action <AndroidJavaObject> inBetween = null)
 {
     using (var builder = AndroidNotificationCenter.CreateNotificationBuilder(notificationId, original, kChannelId))
     {
         return(SerializeDeserializeNotification(builder, inBetween));
     }
 }
Пример #25
0
    private void OnApplicationQuit()
    {
        var notification = new AndroidNotification();

        notification.Title            = PetController.instance._name;
        notification.Text             = PetController.instance._name + " precisa da sua atenção.";
        notification.FireTime         = System.DateTime.Now.AddHours(6);
        notification.ShouldAutoCancel = true;

        //AndroidNotificationCenter.CancelAllScheduledNotifications();
        //AndroidNotificationCenter.SendNotification(notification, "channel_id");

        var identifier = AndroidNotificationCenter.SendNotification(notification, "channel_id");

        if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Scheduled)
        {
            // Replace the currently scheduled notification with a new notification.
            AndroidNotificationCenter.UpdateScheduledNotification(identifier, notification, "channel_id");
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Delivered)
        {
            //Remove the notification from the status bar
            AndroidNotificationCenter.CancelNotification(identifier);
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Unknown)
        {
            AndroidNotificationCenter.SendNotification(notification, "channel_id");
        }
    }
    public void NotificationSerialization_NotificationWithBinderObject()
    {
        const int notificationId = 1234;

        var original = new AndroidNotification();

        original.FireTime         = DateTime.Now.AddSeconds(2);
        original.ShowInForeground = false;  // non default value

        var builder = AndroidNotificationCenter.CreateNotificationBuilder(notificationId, original, kChannelId);
        var extras  = builder.Call <AndroidJavaObject>("getExtras");
        var bitmap  = CreateBitmap();

        Assert.IsNotNull(bitmap);
        extras.Call("putParcelable", "binder_item", bitmap);

        var deserializedData = SerializeDeserializeNotification(builder);

        Assert.AreEqual(original.FireTime.ToString(), deserializedData.Notification.FireTime.ToString());
        Assert.IsFalse(deserializedData.Notification.ShowInForeground);
        var deserializedExtras       = deserializedData.NativeNotification.Get <AndroidJavaObject>("extras");
        var bitmapAfterSerialization = deserializedExtras.Call <AndroidJavaObject>("getParcelable", "binder_item");

        // bitmap is binder object and can't be parcelled, while our fallback custom serialization only preserves our stuff
        Assert.IsNull(bitmapAfterSerialization);
    }
Пример #27
0
        public async Task <List <AndroidNotification> > Send(IEnumerable <AndroidToken> androidTokens, Notification notification, object data, ILogger logger)
        {
            List <AndroidNotification>    responseList                  = new List <AndroidNotification>();
            AndroidTokenRepository        androidTokenRepository        = new AndroidTokenRepository();
            AndroidNotificationRepository androidNotificationRepository = new AndroidNotificationRepository();

            foreach (var androidToken in androidTokens)
            {
                AndroidNotification androidNotification = new AndroidNotification
                {
                    TokenId        = androidToken.Id,
                    NotificationId = notification.Id
                };
                try
                {
                    await SendPushAndroidAsync(androidNotification, notification, androidToken, data, androidTokenRepository);
                }
                finally
                {
                    responseList.Add(androidNotification);
                    try
                    {
                        await androidNotificationRepository.CreateNotification(androidNotification);
                    }
                    catch (Exception ex)
                    {
                        logger.LogError(ex.Message);
                    }
                }
            }
            return(responseList);
        }
    public void CorruptedPrimarySerialization_FallsBack()
    {
        const int notificationId = 234;

        var original = new AndroidNotification();

        original.Title     = "title";
        original.Text      = "text";
        original.SmallIcon = "small_icon";
        original.FireTime  = DateTime.Now;
        original.LargeIcon = "large_icon";

        var deserializedData = SerializeDeserializeNotification(original, notificationId, (prefs) =>
        {
            var data = prefs.Call <string>("getString", "data", "");
            // corrupt data
            using (var editor = prefs.Call <AndroidJavaObject>("edit"))
            {
                editor.Call <AndroidJavaObject>("putString", "data", "jfkasjflksdjflkasdjflkjdsafkjsadfl").Dispose();
                editor.Call("apply");
            }

            var data2 = prefs.Call <string>("getString", "data", "");
            Assert.AreNotEqual(data, data2);
        });

        Assert.AreEqual(original.Title, deserializedData.Notification.Title);
        Assert.AreEqual(original.Text, deserializedData.Notification.Text);
        Assert.AreEqual(original.SmallIcon, deserializedData.Notification.SmallIcon);
        Assert.AreEqual(original.LargeIcon, deserializedData.Notification.LargeIcon);
    }
        public void AndroidNotificationShouldReturnCorrectPayload()
        {
            var notification = new AndroidNotification("notifierName", "notification message");
            var payload      = notification.GetPayload();

            Assert.AreEqual("notification message", payload.GetReflectedProperty("data"));
        }
Пример #30
0
    public IEnumerator SendNotification_NotificationIsReceived_CallMainThread()
    {
        var gameObjects = new GameObject[1];

        AndroidNotificationCenter.NotificationReceivedCallback receivedNotificationHandler =
            delegate(AndroidNotificationIntentData data)
        {
            gameObjects[0]      = new GameObject();
            gameObjects[0].name = "Hello_World";
            Assert.AreEqual("Hello_World", gameObjects[0].name);
        };

        var n = new AndroidNotification();

        n.Title    = "SendNotification_NotificationIsReceived";
        n.Text     = "SendNotification_NotificationIsReceived Text";
        n.FireTime = System.DateTime.Now;

        Debug.LogWarning("SendNotification_NotificationIsReceived_CallMainThread sends notification");

        int originalId = AndroidNotificationCenter.SendNotification(n, kDefaultTestChannel);

        AndroidNotificationCenter.OnNotificationReceived += receivedNotificationHandler;

        yield return(WaitForNotification(8.0f));

        Debug.LogWarning("SendNotification_NotificationIsReceived_CallMainThread completed");

        AndroidNotificationCenter.OnNotificationReceived -= receivedNotificationHandler;
        Assert.AreEqual(1, currentHandler.receivedNotificationCount);
        Assert.AreEqual(originalId, currentHandler.lastNotification.Id);
        Assert.IsNotNull(gameObjects[0]);
    }