颤抖地打开一个信号通知时如何推送到另一个屏幕

时间:2019-09-02 12:55:48

标签: flutter onesignal

打开通知时,我尝试不推送其他页面。但是没事。我使用此代码

 OneSignal.shared
    .setNotificationOpenedHandler((OSNotificationOpenedResult result) {
  // will be called whenever a notification is opened/button pressed.
  Navigator.pushNamed(context, '/setting') ;
});

然后我用此代码接收数据

 OneSignal.shared
    .setNotificationReceivedHandler((OSNotification notification) {
  Map<String, dynamic> asm = notification.payload.additionalData;
  String titles = notification.payload.title;
  String bodys = notification.payload.body;
  // textf = titles;
  // print(asm);
  // print(titles);
  // print(bodys);
});

0 个答案:

没有答案