Skip to content
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

Dynamically update notification content? #40

Open
am2074 opened this issue Jul 30, 2021 · 0 comments
Open

Dynamically update notification content? #40

am2074 opened this issue Jul 30, 2021 · 0 comments

Comments

@am2074
Copy link

am2074 commented Jul 30, 2021

Is it possible to dynamically update the notification content property of FlutterForegroundPlugin.startForegroundService()?

For example:

var number = 0; 

void globalForegroundService() {
  number++;
}

void startForegroundService() async {
   await FlutterForegroundPlugin.setServiceMethodInterval(seconds:` 1);
   await FlutterForegroundPlugin.setServiceMethod(globalForegroundService);
   await FlutterForegroundPlugin.startForegroundService(
    holdWakeLock: false,
    onStarted: () {
      print("Foreground on Started");
    },
    onStopped: () {
      print("Foreground on Stopped");
    },
    title: "Flutter Foreground Service",
    content: number.toString(),
    iconName: "ic_stat_hot_tub",
  );
}

In the content session I would pass the number variable and the notification would reflect the changes each time the number is increased. So far I haven't had any luck with it.

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

1 participant