Skip to content

No notification on macOS #31

Description

@RetroAndDev

Hi !
I got working the package with macOS but now, for an obscure reason, my notifications won't appear

I'm on a M1 MacBook Pro With macOS Sonoma 14.5

Here is my code :

print("App is not focused. Showing desktop notification");
// Display a notification
LocalNotification notification = LocalNotification(
  title: notificationData.title,
  body: notificationData.content,
);

await notification.show();
print("Sent notification");

My notificationData object is fetched from my API (sent by WebSocket). Even with hard-coded strings, it still not works.

I Initialize the Local Notifier from main() in lib/main.dart with :

// Initialize the Notification Manager
if(Platform.isWindows){
  await localNotifier.setup(
    appName: 'StudySuite',
    // The parameter shortcutPolicy only works on Windows
    shortcutPolicy: ShortcutPolicy.requireCreate,
  );
}
else{
  await localNotifier.setup(
    appName: 'StudySuite',
  );

(I put a Windows condition for the shortcutPolicy, it is needed ? Made that when my app doesn't send notifications. Before It was the same for macOS and Windows)

Any idea to get my notification working ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions