thudugala / Plugin.LocalNotification

The local notification plugin provides a way to show local notifications from .Net MAUI and Xamarin Forms apps .
MIT License
401 stars 66 forks source link

Recurring notification is not working #504

Open erossini opened 3 weeks ago

erossini commented 3 weeks ago

In my NET8 MAUI, I'm using the plugin Plugin.LocalNotification. I set a notification to be repeated daily with this code:

INotificationService _notificationService;

var notifyDateTime = 
    DateTime.Parse($"{DateTime.Now.ToShortDateString()} 08:00:00");
var notification = new NotificationRequest
{
    NotificationId = 100,
    Title = AppResources.NotificationsTitle,
    Description = AppResources.NotificationDescription,
    CategoryType = NotificationCategoryType.Status,
    Schedule =
    {
        NotifyTime = notifyDateTime,
        RepeatType = NotificationRepeat.Daily
    }
};

await _notificationService.Show(notification);

The notification is fired once and then nothing. I thought the notification would stay there until the cancellation and fired daily. Do I have to resend the notification again every time it is fired?

I added in the MauiProgram.cs the following lines

var builder = MauiApp.CreateBuilder();
builder
    .UseMauiApp<App>()
    .........
    .UseLocalNotification();

For the other settings, I followed the documentation. In the AndroidManifest.xml I added the following lines

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />

The issue I had was with the Google Play. When I submitted the app with those settings, Google rejected my app because it is not an agenda or a calendar.

erossini commented 2 weeks ago

I just want to give you an update. The notification is working perfectly on iOS. On Android defo it is not working and on some devices the app crashes.