Exemplo n.º 1
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            _tapCount++;

            var list = new List <string>
            {
                typeof(NotificationPage).FullName,
                _tapCount.ToString()
            };

            var notifyDateTime = NotifyDatePicker.Date.Add(NotifyTimePicker.Time);

            if (notifyDateTime <= DateTime.Now)
            {
                notifyDateTime = DateTime.Now.AddSeconds(10);
            }

            var serializeReturningData = ObjectSerializer <List <string> > .SerializeObject(list);

            var notificationService = DependencyService.Get <ILocalNotificationService>();
            var notification        = new Plugin.LocalNotification.LocalNotification
            {
                NotificationId = 100,
                Title          = "Test",
                Description    = $"Tap Count: {_tapCount}",
                BadgeNumber    = _tapCount,
                ReturningData  = serializeReturningData,
                NotifyTime     = UseNotifyTimeSwitch.IsToggled ? notifyDateTime : (DateTime?)null // if not specified notification will show immediately.
            };

            notificationService.Show(notification);
        }
Exemplo n.º 2
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            _tapCount++;

            var list = new List <string>
            {
                typeof(NotificationPage).FullName,
                _tapCount.ToString()
            };

            var serializeReturningData = ObjectSerializer <List <string> > .SerializeObject(list);

            var notificationService = DependencyService.Get <ILocalNotificationService>();
            var notification        = new Plugin.LocalNotification.LocalNotification
            {
                NotificationId = 100,
                Title          = "Test",
                Description    = $"Tap Count: {_tapCount}",
                BadgeNumber    = _tapCount,
                ReturningData  = serializeReturningData,
                //NotifyTime = DateTime.Now.AddSeconds(10)
            };

            notificationService.Show(notification);
        }
Exemplo n.º 3
0
        private void AlertUser(PrayTimeKind prayKind, TimeSpan remainingTime)
        {
            var message =
                $"{prayKind.Stringify()} namazi vaktinin çıkması için kalan süre: {remainingTime.Hours}:{remainingTime.Minutes}:{remainingTime.Seconds}" +
                $"{Environment.NewLine}Bildirim Zamanı: {DateTime.Now.ToString("HH:mm")}";

            var notification = new Plugin.LocalNotification.LocalNotification
            {
                NotificationId = 100,
                Title          = "Namaz Vakti",
                Description    = message,
                ReturningData  = "Dummy data",
                BadgeNumber    = 1
            };

            notificationService.Show(notification);
        }