awesome_notifications icon indicating copy to clipboard operation
awesome_notifications copied to clipboard

actionStream doesn't work when clicked only when restart app

Open kcibdev opened this issue 3 years ago • 3 comments

I listen to actionStream in my index page but whenever I get a notification and click on it just opens the app and does nothing but whenever i restart the app or close and open the app, that's when the actionStream is called and it's kind of annoying. index.dart page

 @override
  void initState() {
    super.initState();
    listenToNotificationAction();
  }

  @override
  void dispose() async {
    disposeAwesomeNotificationProperty();
    super.dispose();
  }

notification.dart page

Future<void> listenToNotificationAction() async {
  AwesomeNotifications().actionStream.listen((event) async {
    var payload = event.payload;

    await gShared("userID").then((value) async {
      if (value != null && value.isNotEmpty && value != '') {
         if (payload['_loc'] == 'appUpdate') {
          urlLaunch(payload['appLink']);
        }
      }
    });
    await AwesomeNotifications().getGlobalBadgeCounter().then(
        (value) => AwesomeNotifications().setGlobalBadgeCounter(value - 1));
  });
  AwesomeNotifications().dismissedStream.listen((event) async {
    print(event.payload);
    await AwesomeNotifications().getGlobalBadgeCounter().then(
        (value) => AwesomeNotifications().setGlobalBadgeCounter(value - 1));
  });
}





disposeAwesomeNotificationProperty() async {
  AwesomeNotifications().actionSink.close();
  AwesomeNotifications().createdSink.close();
}

So whenever i close and open the app it just redirects me to the url after i have already clicked on the notification which doesn't do anything. Am using awesome_notifications: ^0.0.6+12

Is there something am missing

kcibdev avatar Jan 19 '22 13:01 kcibdev

I have a same problem but in different way when restart the app , I still receive the action without do any click / action

m7od99 avatar Jan 19 '22 15:01 m7od99

Please, take a look at our example app and update it to the last version. There is everything that you need to know, including the use of the incrementGlobalBadgeCounter and decrementGlobalBadgeCounter methods.

rafaelsetragni avatar Jan 19 '22 16:01 rafaelsetragni

action

me too

kheson77 avatar May 09 '22 03:05 kheson77

Hi! Sorry for taking so long to respond to your issue on GitHub. I was focused on releasing the new 0.7.0 version of awesome_notifications and awesome_notifications_fcm and i didn't had time enough to do both. But now I can answer all your questions.

So now i'm asking you to recreate this topic using the new issue template. There's a lot of missing informations that i need to understand your problem, and all the instructions are already in the new issue template. Also, remember to check beforehand if your issue was posted by another user.

So I will automatically close all previous issues so far. Sorry for the inconvenience and i will be waiting for your new issue request.

Thank you so much for your support!

rafaelsetragni avatar Sep 29 '22 18:09 rafaelsetragni