I’m developing a mobile app in Xamarin Forms. I have develop local notifications using the latest versione of https://github.com/thudugala/Plugin.LocalNotification
Many times notifications work great, but sometimes notifications are not received/sended or sometimes notifications are recevied all together in a wrong moment compared to the scheduled time.
Most of the tests were made on iOS on real devices. The code I use is more or less this:
var notification = new NotificationRequest
{
NotificationId = idNotific,
Title = "myApp",
Description = txt,
ReturningData = "myData",
Schedule =
{
NotifyTime = timeToTake,
RepeatType = NotificationRepeat.TimeInterval,
NotifyRepeatInterval = new TimeSpan(intervalDays,0,0,0)
}
};
LocalNotificationCenter.Current.Show(notification);
if (Device.RuntimePlatform == Device.iOS)
{
var notificationNext = new NotificationRequest
{
NotificationId = idNotific,
Title = "myApp",
Description = txt,
ReturningData = "myData",
Schedule =
{
NotifyTime = timeToTake,
}
};
LocalNotificationCenter.Current.Show(notificationNext);
}
For iOS, using TimeInterval, I had to add an extra schedule because otherwise the first notification is not sended. The “idNotific” is a big integer number, “timeToTake” is a DateTime and “intervalDays” is a small integer.
I'm trying to figure out why they sometimes don't work properly. I tried to understand if there is a something different from when notifications work and from then don't work, but apparently it's all the same.
Do you have any suggestions? Do you need more info?
Thanks Luca