Skip to content

Notification visible on the lockscreen #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
darshansatra1 opened this issue Jul 7, 2021 · 2 comments
Closed

Notification visible on the lockscreen #6

darshansatra1 opened this issue Jul 7, 2021 · 2 comments

Comments

@darshansatra1
Copy link

I don't know whether it is because of my poor knowledge of the plugin or what but I'm not able to hide the notification of my running foreground service on the lockscreen. Is there any solution for that?

@Dev-hwang
Copy link
Owner

The currently uploaded plug-in is developed so that notification can be seen on the lock screen. I will add more options in the future.

@Dev-hwang
Copy link
Owner

@darshansatra1
Update this plugin and try setting the visibility option value to NotificationVisibility.VISIBILITY_SECRET.

  void _initForegroundTask() {
    FlutterForegroundTask.init(
      notificationOptions: NotificationOptions(
        channelId: 'notification_channel_id',
        channelName: 'Foreground Notification',
        channelDescription: 'This notification appears when a foreground task is running.',
        channelImportance: NotificationChannelImportance.LOW,
        priority: NotificationPriority.LOW,
        visibility: NotificationVisibility.VISIBILITY_SECRET,
        iconData: NotificationIconData(
          resType: ResourceType.mipmap,
          resPrefix: ResourcePrefix.ic,
          name: 'launcher',
        ),
      ),
      foregroundTaskOptions: ForegroundTaskOptions(
        interval: 5000,
        autoRunOnBoot: true,
      ),
      printDevLog: true,
    );
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants